summaryrefslogtreecommitdiffstats
path: root/src/pages
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2022-01-06 18:15:18 +0100
committerArmand Philippot <git@armandphilippot.com>2022-01-06 18:15:18 +0100
commitc3b438a5252e8c8897c868cdda8377e3162fdd69 (patch)
treed0b730c1b3cc971a7ceae02312988071577a368a /src/pages
parentb9c1953c79688fc3f536b7927692309c9780b5da (diff)
refactor: reuse PostHeader for all pages except homepage
Diffstat (limited to 'src/pages')
-rw-r--r--src/pages/404.tsx3
-rw-r--r--src/pages/blog/index.tsx3
-rw-r--r--src/pages/recherche/index.tsx21
3 files changed, 14 insertions, 13 deletions
diff --git a/src/pages/404.tsx b/src/pages/404.tsx
index 6b6fbf5..f98b371 100644
--- a/src/pages/404.tsx
+++ b/src/pages/404.tsx
@@ -1,4 +1,5 @@
import { getLayout } from '@components/Layouts/Layout';
+import PostHeader from '@components/PostHeader/PostHeader';
import { seo } from '@config/seo';
import { t, Trans } from '@lingui/macro';
import { NextPageWithLayout } from '@ts/types/app';
@@ -15,7 +16,7 @@ const error404: NextPageWithLayout = () => {
<meta name="description" content={seo.error404.description} />
</Head>
<div>
- <h1>{t`Page not found`}</h1>
+ <PostHeader title={t`Page not found`} />
<p>
<Trans>
Sorry, it seems that the page you are looking for does not exist.
diff --git a/src/pages/blog/index.tsx b/src/pages/blog/index.tsx
index 095af72..2a58571 100644
--- a/src/pages/blog/index.tsx
+++ b/src/pages/blog/index.tsx
@@ -11,6 +11,7 @@ import PostsList from '@components/PostsList/PostsList';
import useSWRInfinite from 'swr/infinite';
import { Button } from '@components/Buttons';
import { getPublishedPosts } from '@services/graphql/queries';
+import PostHeader from '@components/PostHeader/PostHeader';
const Blog: NextPageWithLayout<BlogPageProps> = ({ fallback }) => {
const getKey = (pageIndex: number, previousData: PostsListData) => {
@@ -46,7 +47,7 @@ const Blog: NextPageWithLayout<BlogPageProps> = ({ fallback }) => {
<title>{seo.blog.title}</title>
<meta name="description" content={seo.blog.description} />
</Head>
- <h1>{t`Blog`}</h1>
+ <PostHeader title={t`Blog`} />
<PostsList data={data} showYears={true} />
{hasNextPage && (
<Button
diff --git a/src/pages/recherche/index.tsx b/src/pages/recherche/index.tsx
index c1ea0d3..5fe35a1 100644
--- a/src/pages/recherche/index.tsx
+++ b/src/pages/recherche/index.tsx
@@ -1,5 +1,6 @@
import { Button } from '@components/Buttons';
import { getLayout } from '@components/Layouts/Layout';
+import PostHeader from '@components/PostHeader/PostHeader';
import PostsList from '@components/PostsList/PostsList';
import { config } from '@config/website';
import { t } from '@lingui/macro';
@@ -57,6 +58,14 @@ const Search: NextPageWithLayout = () => {
const hasNextPage = data && data[data.length - 1].pageInfo.hasNextPage;
+ const title = query
+ ? t`Search results for: ${query}`
+ : t({
+ id: 'msg.search',
+ comment: 'Search page title',
+ message: 'Search',
+ });
+
return (
<>
<Head>
@@ -64,17 +73,7 @@ const Search: NextPageWithLayout = () => {
<meta name="description" content={head.description} />
</Head>
<article>
- <header>
- <h1>
- {query
- ? t`Search results for: ${query}`
- : t({
- id: 'msg.search',
- comment: 'Search page title',
- message: 'Search',
- })}
- </h1>
- </header>
+ <PostHeader title={title} />
<div>
<PostsList data={data} showYears={false} />
{hasNextPage && (