diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-05-17 22:48:41 +0200 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-05-17 22:48:41 +0200 |
| commit | 271ef6debaca7ed9a01829dcef3a37e90a2dff05 (patch) | |
| tree | aa1513b40e7020a44cfcaaedc3a33d39ecfb8af7 /src/pages | |
| parent | 4e53a8654441481029746ff4e35a4a19c8d83709 (diff) | |
chore: use persistent layout
It prevents to rerender the common components between pages (header,
footer...).
Diffstat (limited to 'src/pages')
| -rw-r--r-- | src/pages/404.tsx | 9 | ||||
| -rw-r--r-- | src/pages/_app.tsx | 7 | ||||
| -rw-r--r-- | src/pages/article/[slug].tsx | 16 | ||||
| -rw-r--r-- | src/pages/blog/index.tsx | 14 | ||||
| -rw-r--r-- | src/pages/contact.tsx | 11 | ||||
| -rw-r--r-- | src/pages/cv.tsx | 9 | ||||
| -rw-r--r-- | src/pages/index.tsx | 20 | ||||
| -rw-r--r-- | src/pages/mentions-legales.tsx | 9 | ||||
| -rw-r--r-- | src/pages/projets/[slug].tsx | 14 | ||||
| -rw-r--r-- | src/pages/projets/index.tsx | 10 | ||||
| -rw-r--r-- | src/pages/recherche/index.tsx | 14 | ||||
| -rw-r--r-- | src/pages/sujet/[slug].tsx | 18 | ||||
| -rw-r--r-- | src/pages/thematique/[slug].tsx | 15 |
13 files changed, 127 insertions, 39 deletions
diff --git a/src/pages/404.tsx b/src/pages/404.tsx index 4f6e22d..4ab7784 100644 --- a/src/pages/404.tsx +++ b/src/pages/404.tsx @@ -1,11 +1,13 @@ import Link from '@components/atoms/links/link'; import LinksListWidget from '@components/organisms/widgets/links-list-widget'; +import { getLayout } from '@components/templates/layout/layout'; import PageLayout from '@components/templates/page/page-layout'; import { getThematicsPreview, getTotalThematics, } from '@services/graphql/thematics'; import { getTopicsPreview, getTotalTopics } from '@services/graphql/topics'; +import { type NextPageWithLayout } from '@ts/types/app'; import { type RawThematicPreview, type RawTopicPreview, @@ -17,7 +19,7 @@ import { } from '@utils/helpers/pages'; import useBreadcrumb from '@utils/hooks/use-breadcrumb'; import useSettings from '@utils/hooks/use-settings'; -import { GetStaticProps, NextPage } from 'next'; +import { GetStaticProps } from 'next'; import Head from 'next/head'; import { ReactNode } from 'react'; import { useIntl } from 'react-intl'; @@ -31,7 +33,7 @@ type Error404PageProps = { /** * Error 404 page. */ -const Error404Page: NextPage<Error404PageProps> = ({ +const Error404Page: NextPageWithLayout<Error404PageProps> = ({ thematicsList, topicsList, }) => { @@ -119,6 +121,9 @@ const Error404Page: NextPage<Error404PageProps> = ({ ); }; +Error404Page.getLayout = (page) => + getLayout(page, { useGrid: true, withExtraPadding: true }); + export const getStaticProps: GetStaticProps<Error404PageProps> = async ({ locale, }) => { diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 939b337..5bc9f85 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -1,15 +1,16 @@ +import { type AppPropsWithLayout } from '@ts/types/app'; import { settings } from '@utils/config'; import { AckeeProvider } from '@utils/providers/ackee'; import { PrismThemeProvider } from '@utils/providers/prism-theme'; import { ThemeProvider } from 'next-themes'; -import { AppProps } from 'next/app'; import { useRouter } from 'next/router'; import { IntlProvider } from 'react-intl'; import '../styles/globals.scss'; -const App = ({ Component, pageProps }: AppProps) => { +const App = ({ Component, pageProps }: AppPropsWithLayout) => { const { locale, defaultLocale } = useRouter(); const appLocale: string = locale || settings.locales.defaultLocale; + const getLayout = Component.getLayout ?? ((page) => page); return ( <AckeeProvider domain={settings.ackee.url} siteId={settings.ackee.siteId}> @@ -24,7 +25,7 @@ const App = ({ Component, pageProps }: AppProps) => { enableSystem={true} > <PrismThemeProvider> - <Component {...pageProps} /> + {getLayout(<Component {...pageProps} />, {})} </PrismThemeProvider> </ThemeProvider> </IntlProvider> diff --git a/src/pages/article/[slug].tsx b/src/pages/article/[slug].tsx index a0fb7fc..a3df43b 100644 --- a/src/pages/article/[slug].tsx +++ b/src/pages/article/[slug].tsx @@ -2,6 +2,7 @@ import ButtonLink from '@components/atoms/buttons/button-link'; import Link from '@components/atoms/links/link'; import ResponsiveImage from '@components/molecules/images/responsive-image'; import Sharing from '@components/organisms/widgets/sharing'; +import { getLayout } from '@components/templates/layout/layout'; import PageLayout, { type PageLayoutProps, } from '@components/templates/page/page-layout'; @@ -11,7 +12,11 @@ import { } from '@services/graphql/articles'; import { getPostComments } from '@services/graphql/comments'; import styles from '@styles/pages/article.module.scss'; -import { type Article, type Comment } from '@ts/types/app'; +import { + type Article, + type Comment, + type NextPageWithLayout, +} from '@ts/types/app'; import { loadTranslation, type Messages } from '@utils/helpers/i18n'; import useAddPrismClassAttr from '@utils/hooks/use-add-prism-class-attr'; import useBreadcrumb from '@utils/hooks/use-breadcrumb'; @@ -20,7 +25,7 @@ import usePrismPlugins, { } from '@utils/hooks/use-prism-plugins'; import useReadingTime from '@utils/hooks/use-reading-time'; import useSettings from '@utils/hooks/use-settings'; -import { GetStaticPaths, GetStaticProps, NextPage } from 'next'; +import { GetStaticPaths, GetStaticProps } from 'next'; import Head from 'next/head'; import { useRouter } from 'next/router'; import Script from 'next/script'; @@ -39,7 +44,10 @@ type ArticlePageProps = { /** * Article page. */ -const ArticlePage: NextPage<ArticlePageProps> = ({ comments, post }) => { +const ArticlePage: NextPageWithLayout<ArticlePageProps> = ({ + comments, + post, +}) => { const { content, id, intro, meta, slug, title } = post; const { author, @@ -252,6 +260,8 @@ const ArticlePage: NextPage<ArticlePageProps> = ({ comments, post }) => { ); }; +ArticlePage.getLayout = (page) => getLayout(page, { useGrid: true }); + interface PostParams extends ParsedUrlQuery { slug: string; } diff --git a/src/pages/blog/index.tsx b/src/pages/blog/index.tsx index b6ce221..2676305 100644 --- a/src/pages/blog/index.tsx +++ b/src/pages/blog/index.tsx @@ -1,6 +1,7 @@ import Notice from '@components/atoms/layout/notice'; import PostsList, { type Post } from '@components/organisms/layout/posts-list'; import LinksListWidget from '@components/organisms/widgets/links-list-widget'; +import { getLayout } from '@components/templates/layout/layout'; import PageLayout from '@components/templates/page/page-layout'; import { type EdgesResponse } from '@services/graphql/api'; import { @@ -13,7 +14,11 @@ import { getTotalThematics, } from '@services/graphql/thematics'; import { getTopicsPreview, getTotalTopics } from '@services/graphql/topics'; -import { type Article, type Meta } from '@ts/types/app'; +import { + type Article, + type Meta, + type NextPageWithLayout, +} from '@ts/types/app'; import { RawThematicPreview, RawTopicPreview, @@ -28,7 +33,7 @@ import { import useBreadcrumb from '@utils/hooks/use-breadcrumb'; import usePagination from '@utils/hooks/use-pagination'; import useSettings from '@utils/hooks/use-settings'; -import { GetStaticProps, NextPage } from 'next'; +import { GetStaticProps } from 'next'; import Head from 'next/head'; import { useRouter } from 'next/router'; import Script from 'next/script'; @@ -46,7 +51,7 @@ type BlogPageProps = { /** * Blog index page. */ -const BlogPage: NextPage<BlogPageProps> = ({ +const BlogPage: NextPageWithLayout<BlogPageProps> = ({ articles, thematicsList, topicsList, @@ -268,6 +273,9 @@ const BlogPage: NextPage<BlogPageProps> = ({ ); }; +BlogPage.getLayout = (page) => + getLayout(page, { useGrid: true, withExtraPadding: true }); + export const getStaticProps: GetStaticProps<BlogPageProps> = async ({ locale, }) => { diff --git a/src/pages/contact.tsx b/src/pages/contact.tsx index 617117b..c0d6c79 100644 --- a/src/pages/contact.tsx +++ b/src/pages/contact.tsx @@ -3,22 +3,24 @@ import ContactForm, { type ContactFormProps, } from '@components/organisms/forms/contact-form'; import SocialMedia from '@components/organisms/widgets/social-media'; +import { getLayout } from '@components/templates/layout/layout'; import PageLayout from '@components/templates/page/page-layout'; import { meta } from '@content/pages/contact.mdx'; import styles from '@styles/pages/contact.module.scss'; import { sendMail } from '@services/graphql/contact'; +import { type NextPageWithLayout } from '@ts/types/app'; import { loadTranslation } from '@utils/helpers/i18n'; +import useBreadcrumb from '@utils/hooks/use-breadcrumb'; import useSettings from '@utils/hooks/use-settings'; -import { GetStaticProps, NextPage } from 'next'; +import { GetStaticProps } from 'next'; import Head from 'next/head'; import { useRouter } from 'next/router'; import Script from 'next/script'; import { useState } from 'react'; import { useIntl } from 'react-intl'; import { ContactPage as ContactPageSchema, Graph, WebPage } from 'schema-dts'; -import useBreadcrumb from '@utils/hooks/use-breadcrumb'; -const ContactPage: NextPage = () => { +const ContactPage: NextPageWithLayout = () => { const { dates, intro, seo, title } = meta; const intl = useIntl(); const { items: breadcrumbItems, schema: breadcrumbSchema } = useBreadcrumb({ @@ -164,6 +166,9 @@ const ContactPage: NextPage = () => { ); }; +ContactPage.getLayout = (page) => + getLayout(page, { useGrid: true, withExtraPadding: true }); + export const getStaticProps: GetStaticProps = async ({ locale }) => { const translation = await loadTranslation(locale); diff --git a/src/pages/cv.tsx b/src/pages/cv.tsx index 7936c84..3f035d8 100644 --- a/src/pages/cv.tsx +++ b/src/pages/cv.tsx @@ -3,16 +3,18 @@ import Link from '@components/atoms/links/link'; import List from '@components/atoms/lists/list'; import ImageWidget from '@components/organisms/widgets/image-widget'; import SocialMedia from '@components/organisms/widgets/social-media'; +import { getLayout } from '@components/templates/layout/layout'; import PageLayout, { type PageLayoutProps, } from '@components/templates/page/page-layout'; import CVContent, { data, meta } from '@content/pages/cv.mdx'; import styles from '@styles/pages/cv.module.scss'; +import { type NextPageWithLayout } from '@ts/types/app'; import { loadTranslation } from '@utils/helpers/i18n'; import useBreadcrumb from '@utils/hooks/use-breadcrumb'; import useSettings from '@utils/hooks/use-settings'; import { NestedMDXComponents } from 'mdx/types'; -import { GetStaticProps, NextPage } from 'next'; +import { GetStaticProps } from 'next'; import Head from 'next/head'; import { useRouter } from 'next/router'; import Script from 'next/script'; @@ -23,7 +25,7 @@ import { AboutPage, Graph, WebPage } from 'schema-dts'; /** * CV page. */ -const CVPage: NextPage = () => { +const CVPage: NextPageWithLayout = () => { const intl = useIntl(); const { file, image } = data; const { dates, intro, seo, title } = meta; @@ -186,6 +188,9 @@ const CVPage: NextPage = () => { ); }; +CVPage.getLayout = (page) => + getLayout(page, { useGrid: true, withExtraPadding: true }); + export const getStaticProps: GetStaticProps = async ({ locale }) => { const translation = await loadTranslation(locale); diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 1143a33..a831ea3 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -13,16 +13,16 @@ import Columns, { import CardsList, { type CardsListItem, } from '@components/organisms/layout/cards-list'; -import Layout from '@components/templates/layout/layout'; +import { getLayout } from '@components/templates/layout/layout'; import HomePageContent from '@content/pages/homepage.mdx'; import { getArticlesCard } from '@services/graphql/articles'; import styles from '@styles/pages/home.module.scss'; -import { ArticleCard } from '@ts/types/app'; +import { type ArticleCard, type NextPageWithLayout } from '@ts/types/app'; import { loadTranslation, type Messages } from '@utils/helpers/i18n'; import useBreadcrumb from '@utils/hooks/use-breadcrumb'; import useSettings from '@utils/hooks/use-settings'; import { NestedMDXComponents } from 'mdx/types'; -import { GetStaticProps, NextPage } from 'next'; +import { GetStaticProps } from 'next'; import Head from 'next/head'; import Script from 'next/script'; import { ReactElement } from 'react'; @@ -37,7 +37,7 @@ type HomeProps = { /** * Home page. */ -const HomePage: NextPage<HomeProps> = ({ recentPosts }) => { +const HomePage: NextPageWithLayout<HomeProps> = ({ recentPosts }) => { const intl = useIntl(); const { schema: breadcrumbSchema } = useBreadcrumb({ title: '', @@ -327,7 +327,7 @@ const HomePage: NextPage<HomeProps> = ({ recentPosts }) => { }; return ( - <Layout breadcrumbSchema={breadcrumbSchema} isHome={true}> + <> <Head> <title>{pageTitle}</title> <meta name="description" content={pageDescription} /> @@ -340,11 +340,19 @@ const HomePage: NextPage<HomeProps> = ({ recentPosts }) => { type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify(schemaJsonLd) }} /> + <Script + id="schema-breadcrumb" + type="application/ld+json" + dangerouslySetInnerHTML={{ __html: JSON.stringify(breadcrumbSchema) }} + /> <HomePageContent components={components} /> - </Layout> + </> ); }; +HomePage.getLayout = (page) => + getLayout(page, { isHome: true, withExtraPadding: false }); + export const getStaticProps: GetStaticProps<HomeProps> = async ({ locale }) => { const translation = await loadTranslation(locale); const recentPosts = await getArticlesCard({ first: 3 }); diff --git a/src/pages/mentions-legales.tsx b/src/pages/mentions-legales.tsx index 41bc218..c8d1772 100644 --- a/src/pages/mentions-legales.tsx +++ b/src/pages/mentions-legales.tsx @@ -1,14 +1,16 @@ import Link from '@components/atoms/links/link'; import ResponsiveImage from '@components/molecules/images/responsive-image'; +import { getLayout } from '@components/templates/layout/layout'; import PageLayout, { type PageLayoutProps, } from '@components/templates/page/page-layout'; import LegalNoticeContent, { meta } from '@content/pages/legal-notice.mdx'; +import { type NextPageWithLayout } from '@ts/types/app'; import { loadTranslation } from '@utils/helpers/i18n'; import useBreadcrumb from '@utils/hooks/use-breadcrumb'; import useSettings from '@utils/hooks/use-settings'; import { NestedMDXComponents } from 'mdx/types'; -import { GetStaticProps, NextPage } from 'next'; +import { GetStaticProps } from 'next'; import Head from 'next/head'; import { useRouter } from 'next/router'; import Script from 'next/script'; @@ -17,7 +19,7 @@ import { Article, Graph, WebPage } from 'schema-dts'; /** * Legal Notice page. */ -const LegalNoticePage: NextPage = () => { +const LegalNoticePage: NextPageWithLayout = () => { const { dates, intro, seo, title } = meta; const { items: breadcrumbItems, schema: breadcrumbSchema } = useBreadcrumb({ title, @@ -111,6 +113,9 @@ const LegalNoticePage: NextPage = () => { ); }; +LegalNoticePage.getLayout = (page) => + getLayout(page, { useGrid: true, withExtraPadding: true }); + export const getStaticProps: GetStaticProps = async ({ locale }) => { const translation = await loadTranslation(locale); diff --git a/src/pages/projets/[slug].tsx b/src/pages/projets/[slug].tsx index 1a90e0f..cf7d0dc 100644 --- a/src/pages/projets/[slug].tsx +++ b/src/pages/projets/[slug].tsx @@ -6,10 +6,15 @@ import Code from '@components/molecules/layout/code'; import Gallery from '@components/organisms/images/gallery'; import Overview, { OverviewMeta } from '@components/organisms/layout/overview'; import Sharing from '@components/organisms/widgets/sharing'; +import { getLayout } from '@components/templates/layout/layout'; import PageLayout, { PageLayoutProps, } from '@components/templates/page/page-layout'; -import { ProjectPreview, Repos } from '@ts/types/app'; +import { + type NextPageWithLayout, + type ProjectPreview, + type Repos, +} from '@ts/types/app'; import { loadTranslation, Messages } from '@utils/helpers/i18n'; import { getProjectData, getProjectFilenames } from '@utils/helpers/projects'; import { capitalize } from '@utils/helpers/strings'; @@ -17,7 +22,7 @@ import useBreadcrumb from '@utils/hooks/use-breadcrumb'; import useGithubApi, { RepoData } from '@utils/hooks/use-github-api'; import useSettings from '@utils/hooks/use-settings'; import { MDXComponents, NestedMDXComponents } from 'mdx/types'; -import { GetStaticPaths, GetStaticProps, NextPage } from 'next'; +import { GetStaticPaths, GetStaticProps } from 'next'; import Head from 'next/head'; import { useRouter } from 'next/router'; import Script from 'next/script'; @@ -33,7 +38,7 @@ type ProjectPageProps = { /** * Project page. */ -const ProjectPage: NextPage<ProjectPageProps> = ({ project }) => { +const ProjectPage: NextPageWithLayout<ProjectPageProps> = ({ project }) => { const { id, intro, meta, title } = project; const { cover, dates, license, repos, seo, technologies } = meta; const intl = useIntl(); @@ -207,6 +212,9 @@ const ProjectPage: NextPage<ProjectPageProps> = ({ project }) => { ); }; +ProjectPage.getLayout = (page) => + getLayout(page, { useGrid: true, withExtraPadding: true }); + export const getStaticProps: GetStaticProps<ProjectPageProps> = async ({ locale, params, diff --git a/src/pages/projets/index.tsx b/src/pages/projets/index.tsx index 4a58269..d500b6b 100644 --- a/src/pages/projets/index.tsx +++ b/src/pages/projets/index.tsx @@ -2,16 +2,17 @@ import Link from '@components/atoms/links/link'; import CardsList, { CardsListItem, } from '@components/organisms/layout/cards-list'; +import { getLayout } from '@components/templates/layout/layout'; import PageLayout from '@components/templates/page/page-layout'; import PageContent, { meta } from '@content/pages/projects.mdx'; import styles from '@styles/pages/projects.module.scss'; -import { ProjectCard } from '@ts/types/app'; +import { type NextPageWithLayout, type ProjectCard } from '@ts/types/app'; import { loadTranslation, Messages } from '@utils/helpers/i18n'; import { getProjectsCard } from '@utils/helpers/projects'; import useBreadcrumb from '@utils/hooks/use-breadcrumb'; import useSettings from '@utils/hooks/use-settings'; import { NestedMDXComponents } from 'mdx/types'; -import { GetStaticProps, NextPage } from 'next'; +import { GetStaticProps } from 'next'; import Head from 'next/head'; import { useRouter } from 'next/router'; import Script from 'next/script'; @@ -25,7 +26,7 @@ type ProjectsPageProps = { /** * Projects page. */ -const ProjectsPage: NextPage<ProjectsPageProps> = ({ projects }) => { +const ProjectsPage: NextPageWithLayout<ProjectsPageProps> = ({ projects }) => { const { dates, seo, title } = meta; const { items: breadcrumbItems, schema: breadcrumbSchema } = useBreadcrumb({ title, @@ -122,6 +123,9 @@ const ProjectsPage: NextPage<ProjectsPageProps> = ({ projects }) => { ); }; +ProjectsPage.getLayout = (page) => + getLayout(page, { useGrid: true, withExtraPadding: true }); + export const getStaticProps: GetStaticProps<ProjectsPageProps> = async ({ locale, }) => { diff --git a/src/pages/recherche/index.tsx b/src/pages/recherche/index.tsx index d88a293..09091c8 100644 --- a/src/pages/recherche/index.tsx +++ b/src/pages/recherche/index.tsx @@ -2,6 +2,7 @@ import Notice from '@components/atoms/layout/notice'; import Spinner from '@components/atoms/loaders/spinner'; import PostsList, { type Post } from '@components/organisms/layout/posts-list'; import LinksListWidget from '@components/organisms/widgets/links-list-widget'; +import { getLayout } from '@components/templates/layout/layout'; import PageLayout from '@components/templates/page/page-layout'; import { type EdgesResponse } from '@services/graphql/api'; import { @@ -14,7 +15,11 @@ import { getTotalThematics, } from '@services/graphql/thematics'; import { getTopicsPreview, getTotalTopics } from '@services/graphql/topics'; -import { type Article, type Meta } from '@ts/types/app'; +import { + type Article, + type Meta, + type NextPageWithLayout, +} from '@ts/types/app'; import { RawThematicPreview, RawTopicPreview, @@ -29,7 +34,7 @@ import useBreadcrumb from '@utils/hooks/use-breadcrumb'; import useDataFromAPI from '@utils/hooks/use-data-from-api'; import usePagination from '@utils/hooks/use-pagination'; import useSettings from '@utils/hooks/use-settings'; -import { GetStaticProps, NextPage } from 'next'; +import { GetStaticProps } from 'next'; import Head from 'next/head'; import { useRouter } from 'next/router'; import Script from 'next/script'; @@ -45,7 +50,7 @@ type SearchPageProps = { /** * Search page. */ -const SearchPage: NextPage<SearchPageProps> = ({ +const SearchPage: NextPageWithLayout<SearchPageProps> = ({ thematicsList, topicsList, }) => { @@ -283,6 +288,9 @@ const SearchPage: NextPage<SearchPageProps> = ({ ); }; +SearchPage.getLayout = (page) => + getLayout(page, { useGrid: true, withExtraPadding: true }); + export const getStaticProps: GetStaticProps<SearchPageProps> = async ({ locale, }) => { diff --git a/src/pages/sujet/[slug].tsx b/src/pages/sujet/[slug].tsx index 348fe05..6277293 100644 --- a/src/pages/sujet/[slug].tsx +++ b/src/pages/sujet/[slug].tsx @@ -2,6 +2,7 @@ import Heading from '@components/atoms/headings/heading'; import ResponsiveImage from '@components/molecules/images/responsive-image'; import PostsList, { type Post } from '@components/organisms/layout/posts-list'; import LinksListWidget from '@components/organisms/widgets/links-list-widget'; +import { getLayout } from '@components/templates/layout/layout'; import PageLayout, { type PageLayoutProps, } from '@components/templates/page/page-layout'; @@ -12,7 +13,12 @@ import { getTotalTopics, } from '@services/graphql/topics'; import styles from '@styles/pages/topic.module.scss'; -import { type Article, type PageLink, type Topic } from '@ts/types/app'; +import { + type Article, + type NextPageWithLayout, + type PageLink, + type Topic, +} from '@ts/types/app'; import { loadTranslation, type Messages } from '@utils/helpers/i18n'; import { getLinksListItems, @@ -21,7 +27,7 @@ import { } from '@utils/helpers/pages'; import useBreadcrumb from '@utils/hooks/use-breadcrumb'; import useSettings from '@utils/hooks/use-settings'; -import { GetStaticPaths, GetStaticProps, NextPage } from 'next'; +import { GetStaticPaths, GetStaticProps } from 'next'; import Head from 'next/head'; import { useRouter } from 'next/router'; import Script from 'next/script'; @@ -35,7 +41,10 @@ export type TopicPageProps = { translation: Messages; }; -const TopicPage: NextPage<TopicPageProps> = ({ currentTopic, topics }) => { +const TopicPage: NextPageWithLayout<TopicPageProps> = ({ + currentTopic, + topics, +}) => { const { content, intro, meta, slug, title } = currentTopic; const { articles, @@ -208,6 +217,9 @@ const TopicPage: NextPage<TopicPageProps> = ({ currentTopic, topics }) => { ); }; +TopicPage.getLayout = (page) => + getLayout(page, { useGrid: true, withExtraPadding: true }); + interface TopicParams extends ParsedUrlQuery { slug: string; } diff --git a/src/pages/thematique/[slug].tsx b/src/pages/thematique/[slug].tsx index 13ef0da..23e6a8b 100644 --- a/src/pages/thematique/[slug].tsx +++ b/src/pages/thematique/[slug].tsx @@ -1,6 +1,7 @@ import Heading from '@components/atoms/headings/heading'; import PostsList, { type Post } from '@components/organisms/layout/posts-list'; import LinksListWidget from '@components/organisms/widgets/links-list-widget'; +import { getLayout } from '@components/templates/layout/layout'; import PageLayout, { type PageLayoutProps, } from '@components/templates/page/page-layout'; @@ -10,7 +11,12 @@ import { getThematicsPreview, getTotalThematics, } from '@services/graphql/thematics'; -import { type Article, type PageLink, type Thematic } from '@ts/types/app'; +import { + type Article, + type NextPageWithLayout, + type PageLink, + type Thematic, +} from '@ts/types/app'; import { loadTranslation, type Messages } from '@utils/helpers/i18n'; import { getLinksListItems, @@ -19,7 +25,7 @@ import { } from '@utils/helpers/pages'; import useBreadcrumb from '@utils/hooks/use-breadcrumb'; import useSettings from '@utils/hooks/use-settings'; -import { GetStaticPaths, GetStaticProps, NextPage } from 'next'; +import { GetStaticPaths, GetStaticProps } from 'next'; import Head from 'next/head'; import { useRouter } from 'next/router'; import Script from 'next/script'; @@ -33,7 +39,7 @@ export type ThematicPageProps = { translation: Messages; }; -const ThematicPage: NextPage<ThematicPageProps> = ({ +const ThematicPage: NextPageWithLayout<ThematicPageProps> = ({ currentThematic, thematics, }) => { @@ -191,6 +197,9 @@ const ThematicPage: NextPage<ThematicPageProps> = ({ ); }; +ThematicPage.getLayout = (page) => + getLayout(page, { useGrid: true, withExtraPadding: true }); + interface ThematicParams extends ParsedUrlQuery { slug: string; } |
