diff options
| author | Armand Philippot <git@armandphilippot.com> | 2023-09-19 15:47:08 +0200 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2023-09-19 19:16:58 +0200 |
| commit | 03331c44276ec56e9f235e4d5ee75030455a753f (patch) | |
| tree | b9248a7db3090e02bf38fe573f2ea973ed8a1561 /src/pages | |
| parent | 2faf2e34331703b3bdea3eb487cb8799c8d65377 (diff) | |
build(deps): bump all dependencies
* MDX type has changed so some components props had to be updated
* Since Storybook now supports TS, I renamed the main/preview files
Diffstat (limited to 'src/pages')
| -rw-r--r-- | src/pages/cv.tsx | 92 | ||||
| -rw-r--r-- | src/pages/index.tsx | 16 | ||||
| -rw-r--r-- | src/pages/mentions-legales.tsx | 4 | ||||
| -rw-r--r-- | src/pages/projets/[slug].tsx | 10 | ||||
| -rw-r--r-- | src/pages/projets/index.tsx | 4 |
5 files changed, 88 insertions, 38 deletions
diff --git a/src/pages/cv.tsx b/src/pages/cv.tsx index 16b83f0..9e01e2f 100644 --- a/src/pages/cv.tsx +++ b/src/pages/cv.tsx @@ -1,12 +1,12 @@ -import { NestedMDXComponents } from 'mdx/types'; +import { MDXComponents } from 'mdx/types'; import { GetStaticProps } from 'next'; import Head from 'next/head'; import { useRouter } from 'next/router'; import Script from 'next/script'; -import React, { ReactNode } from 'react'; +import React, { AnchorHTMLAttributes, HTMLAttributes, ReactNode } from 'react'; import { useIntl } from 'react-intl'; -import Heading, { HeadingProps } from '../components/atoms/headings/heading'; -import Link, { LinkProps } from '../components/atoms/links/link'; +import Heading from '../components/atoms/headings/heading'; +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'; @@ -26,30 +26,80 @@ import { import useBreadcrumb from '../utils/hooks/use-breadcrumb'; import useSettings from '../utils/hooks/use-settings'; -const ExternalLink = (props: LinkProps) => <Link external={true} {...props} />; - -const H1 = (props: Omit<HeadingProps, 'level'>) => { - return <Heading level={1} {...props} />; +const ExternalLink = ({ + children = '', + href = '', + ...props +}: AnchorHTMLAttributes<HTMLAnchorElement>) => ( + <Link {...props} external={true} href={href}> + {children} + </Link> +); + +const H1 = ({ + children = '', + ...props +}: HTMLAttributes<HTMLHeadingElement>) => { + return ( + <Heading {...props} level={1}> + {children} + </Heading> + ); }; -const H2 = (props: Omit<HeadingProps, 'level'>) => { - return <Heading level={2} {...props} />; +const H2 = ({ + children = '', + ...props +}: HTMLAttributes<HTMLHeadingElement>) => { + return ( + <Heading {...props} level={2}> + {children} + </Heading> + ); }; -const H3 = (props: Omit<HeadingProps, 'level'>) => { - return <Heading level={3} {...props} />; +const H3 = ({ + children = '', + ...props +}: HTMLAttributes<HTMLHeadingElement>) => { + return ( + <Heading {...props} level={3}> + {children} + </Heading> + ); }; -const H4 = (props: Omit<HeadingProps, 'level'>) => { - return <Heading level={4} {...props} />; +const H4 = ({ + children = '', + ...props +}: HTMLAttributes<HTMLHeadingElement>) => { + return ( + <Heading {...props} level={4}> + {children} + </Heading> + ); }; -const H5 = (props: Omit<HeadingProps, 'level'>) => { - return <Heading level={5} {...props} />; +const H5 = ({ + children = '', + ...props +}: HTMLAttributes<HTMLHeadingElement>) => { + return ( + <Heading {...props} level={5}> + {children} + </Heading> + ); }; -const H6 = (props: Omit<HeadingProps, 'level'>) => { - return <Heading level={6} {...props} />; +const H6 = ({ + children = '', + ...props +}: HTMLAttributes<HTMLHeadingElement>) => { + return ( + <Heading {...props} level={6}> + {children} + </Heading> + ); }; /** @@ -147,7 +197,7 @@ const CVPage: NextPageWithLayout = () => { }); const schemaJsonLd = getSchemaJson([webpageSchema, cvSchema]); - const components: NestedMDXComponents = { + const components: MDXComponents = { a: ExternalLink, h1: H1, h2: H2, @@ -155,8 +205,8 @@ const CVPage: NextPageWithLayout = () => { h4: H4, h5: H5, h6: H6, - Link: Link, - List: List, + Link, + List, }; return ( diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 0738805..291d011 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -1,4 +1,4 @@ -import { NestedMDXComponents } from 'mdx/types'; +import { MDXComponents } from 'mdx/types'; import { GetStaticProps } from 'next'; import Head from 'next/head'; import Script from 'next/script'; @@ -282,17 +282,17 @@ const HomePage: NextPageWithLayout<HomeProps> = ({ recentPosts }) => { ); }; - const components: NestedMDXComponents = { - CodingLinks: CodingLinks, - ColdarkRepos: ColdarkRepos, - Column: Column, + const components: MDXComponents = { + CodingLinks, + ColdarkRepos, + Column, Columns: StyledColumns, Image: ResponsiveImage, - LibreLinks: LibreLinks, - MoreLinks: MoreLinks, + LibreLinks, + MoreLinks, RecentPosts: getRecentPosts, Section: getSection, - ShaarliLink: ShaarliLink, + ShaarliLink, }; const { website } = useSettings(); diff --git a/src/pages/mentions-legales.tsx b/src/pages/mentions-legales.tsx index 7608e4b..49363dc 100644 --- a/src/pages/mentions-legales.tsx +++ b/src/pages/mentions-legales.tsx @@ -1,4 +1,4 @@ -import { NestedMDXComponents } from 'mdx/types'; +import { MDXComponents } from 'mdx/types'; import { GetStaticProps } from 'next'; import Head from 'next/head'; import { useRouter } from 'next/router'; @@ -41,7 +41,7 @@ const LegalNoticePage: NextPageWithLayout = () => { : undefined, }; - const components: NestedMDXComponents = { + const components: MDXComponents = { Image: ResponsiveImage, Link, }; diff --git a/src/pages/projets/[slug].tsx b/src/pages/projets/[slug].tsx index 1614b1b..eb007bb 100644 --- a/src/pages/projets/[slug].tsx +++ b/src/pages/projets/[slug].tsx @@ -1,4 +1,4 @@ -import { MDXComponents, NestedMDXComponents } from 'mdx/types'; +import { MDXComponents } from 'mdx/types'; import { GetStaticPaths, GetStaticProps } from 'next'; import dynamic from 'next/dynamic'; import Head from 'next/head'; @@ -73,11 +73,11 @@ const ProjectPage: NextPageWithLayout<ProjectPageProps> = ({ project }) => { } ); - const components: NestedMDXComponents = { - Code: Code, - Gallery: Gallery, + const components: MDXComponents = { + Code, + Gallery, Image: BorderedImage, - Link: Link, + Link, }; const { website } = useSettings(); diff --git a/src/pages/projets/index.tsx b/src/pages/projets/index.tsx index 2068b30..22a5346 100644 --- a/src/pages/projets/index.tsx +++ b/src/pages/projets/index.tsx @@ -1,4 +1,4 @@ -import { NestedMDXComponents } from 'mdx/types'; +import { MDXComponents } from 'mdx/types'; import { GetStaticProps } from 'next'; import Head from 'next/head'; import { useRouter } from 'next/router'; @@ -52,7 +52,7 @@ const ProjectsPage: NextPageWithLayout<ProjectsPageProps> = ({ projects }) => { } ); - const components: NestedMDXComponents = { + const components: MDXComponents = { Link, }; |
