fix(guide): add more headings

This commit is contained in:
iCrawl
2023-04-29 20:10:06 +02:00
parent 8d212e4859
commit 6229597db2
5 changed files with 39 additions and 12 deletions

View File

@@ -0,0 +1,9 @@
import type { HTMLAttributes, PropsWithChildren } from 'react';
export default function H2({ children, className, ...props }: PropsWithChildren<HTMLAttributes<HTMLHeadingElement>>) {
return (
<h2 className={`group ${className}`} {...props}>
{children}
</h2>
);
}

View File

@@ -0,0 +1,9 @@
import type { HTMLAttributes, PropsWithChildren } from 'react';
export default function H3({ children, className, ...props }: PropsWithChildren<HTMLAttributes<HTMLHeadingElement>>) {
return (
<h3 className={`group ${className}`} {...props}>
{children}
</h3>
);
}

View File

@@ -0,0 +1,9 @@
import type { HTMLAttributes, PropsWithChildren } from 'react';
export default function H4({ children, className, ...props }: PropsWithChildren<HTMLAttributes<HTMLHeadingElement>>) {
return (
<h4 className={`group ${className}`} {...props}>
{children}
</h4>
);
}

View File

@@ -3,6 +3,9 @@
import { Alert, Section, DiscordMessages, DiscordMessage, DiscordMessageEmbed } from '@discordjs/ui';
import { useMDXComponent } from 'next-contentlayer/hooks';
import H1 from './H1';
import H2 from './H2';
import H3 from './H3';
import H4 from './H4';
import { DocsLink } from '~/components/DocsLink';
import { ResultingCode } from '~/components/ResultingCode';
@@ -20,6 +23,9 @@ export function Mdx({ code }: { code: string }) {
DocsLink,
ResultingCode,
h1: H1,
h2: H2,
h3: H3,
h4: H4,
}}
/>
);

View File

@@ -52,30 +52,24 @@ export default defineConfig({
'place-items': 'center',
'scroll-margin-top': '6.5rem',
},
'.level-h1': {
margin: '1rem 0',
},
h2: {
display: 'flex',
'place-items': 'center',
'margin-top': '1.25em',
'scroll-margin-top': '6.5rem',
},
'.level-h2': {
margin: '1.25em 0',
},
h3: {
display: 'flex',
'place-items': 'center',
'margin-top': '1.25em',
'scroll-margin-top': '6.5rem',
},
'.level-h3': {
margin: '1.25em 0',
},
h4: {
display: 'flex',
'place-items': 'center',
'margin-top': '1.25em',
'scroll-margin-top': '6.5rem',
},
'.level-h4': {
margin: '1.25em 0',
},
// eslint-disable-next-line id-length
p: {
margin: '.5em 0',