From 8105e2577d4aa401f960e78085f6038eb879ee8a Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Fri, 24 Dec 2021 15:06:12 +0100
Subject: chore: replace legal notice page content with MDX content

I cannot use WordPress shortcodes from a custom plugin through WP
GraphQL so I'm using mdx file instead to define the page content.
---
 src/pages/mentions-legales.tsx | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

(limited to 'src/pages/mentions-legales.tsx')

diff --git a/src/pages/mentions-legales.tsx b/src/pages/mentions-legales.tsx
index 41e9a0c..6bb1a55 100644
--- a/src/pages/mentions-legales.tsx
+++ b/src/pages/mentions-legales.tsx
@@ -1,14 +1,13 @@
 import { getLayout } from '@components/Layouts/Layout';
 import ToC from '@components/ToC/ToC';
 import { seo } from '@config/seo';
-import { getPageByUri } from '@services/graphql/queries';
 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 LegalNoticeContent, { meta } from '@content/pages/legal-notice.mdx';
 
-const LegalNotice: NextPageWithLayout<PageProps> = ({ page }) => {
+const LegalNotice: NextPageWithLayout = () => {
   return (
     <>
       <Head>
@@ -17,17 +16,10 @@ const LegalNotice: NextPageWithLayout<PageProps> = ({ page }) => {
       </Head>
       <article>
         <header>
-          <h1>{page.title}</h1>
-          {page.content && (
-            <div dangerouslySetInnerHTML={{ __html: page.intro }}></div>
-          )}
+          <h1>{meta.title}</h1>
         </header>
         <ToC />
-        <div
-          dangerouslySetInnerHTML={{
-            __html: page.content ? page.content : page.intro,
-          }}
-        ></div>
+        <LegalNoticeContent />
       </article>
     </>
   );
@@ -42,13 +34,11 @@ export const getStaticProps: GetStaticProps = async (
     context.locale!,
     process.env.NODE_ENV === 'production'
   );
-  const page = await getPageByUri('/mentions-legales/');
-  const breadcrumbTitle = page.title;
+  const breadcrumbTitle = meta.title;
 
   return {
     props: {
       breadcrumbTitle,
-      page,
       translation,
     },
   };
-- 
cgit v1.2.3

