aboutsummaryrefslogtreecommitdiffstats
path: root/src/pages/index.tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-09-27 17:38:23 +0200
committerArmand Philippot <git@armandphilippot.com>2023-10-24 12:25:00 +0200
commit7255d25f6834a208c0ed44636356cc260f6ab6ba (patch)
tree88016a958190f766a3ac0ab4b77f4732e17502e8 /src/pages/index.tsx
parentba793e043e4d8515b1a9ea490ee2c5f92b1fd6c2 (diff)
refactor(components): rewrite Heading component
* remove `alignment` and `withMargin` props (consumer should handle that) * move styles to Sass placeholders to avoid repeats with headings coming from WordPress * refactor some other components that depend on Heading to avoid ESlint errors
Diffstat (limited to 'src/pages/index.tsx')
-rw-r--r--src/pages/index.tsx63
1 files changed, 62 insertions, 1 deletions
diff --git a/src/pages/index.tsx b/src/pages/index.tsx
index c06fb7e..d99462f 100644
--- a/src/pages/index.tsx
+++ b/src/pages/index.tsx
@@ -2,7 +2,7 @@ import type { MDXComponents } from 'mdx/types';
import type { GetStaticProps } from 'next';
import Head from 'next/head';
import Script from 'next/script';
-import type { FC } from 'react';
+import type { FC, HTMLAttributes } from 'react';
import { useIntl } from 'react-intl';
import FeedIcon from '../assets/images/icon-feed.svg';
import {
@@ -19,6 +19,7 @@ import {
ResponsiveImage,
Section,
type SectionProps,
+ Heading,
} from '../components';
import HomePageContent from '../content/pages/homepage.mdx';
import { getArticlesCard } from '../services/graphql';
@@ -29,6 +30,60 @@ import { getSchemaJson, getWebPageSchema } from '../utils/helpers';
import { loadTranslation, type Messages } from '../utils/helpers/server';
import { useBreadcrumb, useSettings } from '../utils/hooks';
+const H1 = ({
+ children = '',
+ ...props
+}: HTMLAttributes<HTMLHeadingElement>) => (
+ <Heading {...props} level={1}>
+ {children}
+ </Heading>
+);
+
+const H2 = ({
+ children = '',
+ ...props
+}: HTMLAttributes<HTMLHeadingElement>) => (
+ <Heading {...props} level={2}>
+ {children}
+ </Heading>
+);
+
+const H3 = ({
+ children = '',
+ ...props
+}: HTMLAttributes<HTMLHeadingElement>) => (
+ <Heading {...props} level={3}>
+ {children}
+ </Heading>
+);
+
+const H4 = ({
+ children = '',
+ ...props
+}: HTMLAttributes<HTMLHeadingElement>) => (
+ <Heading {...props} level={4}>
+ {children}
+ </Heading>
+);
+
+const H5 = ({
+ children = '',
+ ...props
+}: HTMLAttributes<HTMLHeadingElement>) => (
+ <Heading {...props} level={5}>
+ {children}
+ </Heading>
+);
+
+const H6 = ({
+ children = '',
+ ...props
+}: HTMLAttributes<HTMLHeadingElement>) => (
+ <Heading {...props} level={6}>
+ {children}
+ </Heading>
+);
+
/**
* Retrieve a list of coding links.
*
@@ -276,6 +331,12 @@ const HomePage: NextPageWithLayout<HomeProps> = ({ recentPosts }) => {
ColdarkRepos,
Column,
Columns: StyledColumns,
+ h1: H1,
+ h2: H2,
+ h3: H3,
+ h4: H4,
+ h5: H5,
+ h6: H6,
Image: ResponsiveImage,
LibreLinks,
MoreLinks,