diff options
| author | Armand Philippot <git@armandphilippot.com> | 2021-12-15 19:17:11 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2021-12-15 19:26:26 +0100 |
| commit | 94f1c1fbea903e677476a167e51b549bb0c53330 (patch) | |
| tree | 3e0ac1c6acab52b3d31a8130788d39b2c0f9984e /src/pages/mentions-legales.tsx | |
| parent | 3760b757f8fd35eafc340a43f7980ab954413f4e (diff) | |
chore: create legal notice view
Diffstat (limited to 'src/pages/mentions-legales.tsx')
| -rw-r--r-- | src/pages/mentions-legales.tsx | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/pages/mentions-legales.tsx b/src/pages/mentions-legales.tsx new file mode 100644 index 0000000..4ff4104 --- /dev/null +++ b/src/pages/mentions-legales.tsx @@ -0,0 +1,48 @@ +import Layout from '@components/Layouts/Layout'; +import { seo } from '@config/seo'; +import { getLegalNoticePage } from '@services/graphql/pages'; +import { NextPageWithLayout } from '@ts/types/app'; +import { PageProps } from '@ts/types/pages'; +import { loadTranslation } from '@utils/helpers/i18n'; +import { GetStaticProps, GetStaticPropsContext } from 'next'; +import Head from 'next/head'; +import { ReactElement } from 'react'; + +const LegalNotice: NextPageWithLayout<PageProps> = ({ page }) => { + return ( + <> + <Head> + <title>{seo.legalNotice.title}</title> + <meta name="description" content={seo.legalNotice.description} /> + </Head> + <article> + <header> + <h1>{page.title}</h1> + <div dangerouslySetInnerHTML={{ __html: page.intro }}></div> + </header> + <div dangerouslySetInnerHTML={{ __html: page.content }}></div> + </article> + </> + ); +}; + +LegalNotice.getLayout = (page: ReactElement) => <Layout>{page}</Layout>; + +export const getStaticProps: GetStaticProps = async ( + context: GetStaticPropsContext +) => { + const translation = await loadTranslation( + context.locale!, + process.env.NODE_ENV === 'production' + ); + const page = await getLegalNoticePage(); + + return { + props: { + page, + translation, + }, + }; +}; + +export default LegalNotice; |
