From 0ac690339083f01a0b12a74ec117eeccd055e932 Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Wed, 22 Nov 2023 17:45:03 +0100
Subject: refactor(components,pages): extract MDX components mapping from pages

Instead of repeating the overriding on each pages, we should define
it in one place and reuse it in pages.
By default it is not possible to override native HTML tags with MDX
so I added a plugin in next config to allow it.
---
 src/pages/projets/index.tsx | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

(limited to 'src/pages/projets/index.tsx')

diff --git a/src/pages/projets/index.tsx b/src/pages/projets/index.tsx
index 0b9a91c..fc6eb5f 100644
--- a/src/pages/projets/index.tsx
+++ b/src/pages/projets/index.tsx
@@ -1,5 +1,4 @@
 /* eslint-disable max-statements */
-import type { MDXComponents } from 'mdx/types';
 import type { GetStaticProps } from 'next';
 import Head from 'next/head';
 import NextImage from 'next/image';
@@ -16,13 +15,13 @@ import {
   getLayout,
   Grid,
   type GridItem,
-  Link,
   MetaList,
   MetaItem,
   Page,
   PageHeader,
   PageBody,
 } from '../../components';
+import { mdxComponents } from '../../components/mdx';
 import PageContent, { meta } from '../../content/pages/projects.mdx';
 import styles from '../../styles/pages/projects.module.scss';
 import type { NextPageWithLayout, ProjectCard } from '../../types';
@@ -40,10 +39,6 @@ import {
 } from '../../utils/helpers/server';
 import { useBreadcrumb } from '../../utils/hooks';
 
-const components: MDXComponents = {
-  Link,
-};
-
 type ProjectsPageProps = {
   projects: ProjectCard[];
   translation?: Messages;
@@ -167,7 +162,7 @@ const ProjectsPage: NextPageWithLayout<ProjectsPageProps> = ({ projects }) => {
       />
       <PageHeader
         heading={title}
-        intro={<PageContent components={components} />}
+        intro={<PageContent components={mdxComponents} />}
       />
       <PageBody className={styles.body}>
         <Grid
-- 
cgit v1.2.3

