fix extendedHx href
This commit is contained in:
parent
9bb235133b
commit
d7efcc1073
1 changed files with 1 additions and 1 deletions
|
@ -8,7 +8,7 @@ import '../styles/index.sass';
|
||||||
const hx = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] as const;
|
const hx = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] as const;
|
||||||
const extendedHx = Object.fromEntries(hx.map(H => [H,
|
const extendedHx = Object.fromEntries(hx.map(H => [H,
|
||||||
({children, id, ...props}: React.ComponentProps<(typeof hx)[number]>) => <H id={id} {...props}>
|
({children, id, ...props}: React.ComponentProps<(typeof hx)[number]>) => <H id={id} {...props}>
|
||||||
{id && <a className="anchor" />}
|
{id && <a className="anchor" href={'#'+encodeURIComponent(id)} />}
|
||||||
{children}
|
{children}
|
||||||
</H>,
|
</H>,
|
||||||
]));
|
]));
|
||||||
|
|
Loading…
Reference in a new issue