Improve heading href

This commit is contained in:
SonMooSans
2023-09-15 18:04:16 +08:00
parent b45c6868d8
commit cbefd3cda2
@@ -13,14 +13,15 @@ export function Heading<T extends Types = 'h1'>({
const As = as ?? 'h1'
return (
<As {...props} className={clsx('nd-group nd-scroll-m-20', props.className)}>
{props.children}
<a
href={`#${props.id}`}
aria-label="Link to section"
className="nd-not-prose nd-opacity-0 nd-font-normal nd-ml-2 nd-transition-opacity nd-text-muted-foreground group-hover:nd-opacity-100"
>
#
<As {...props} className={clsx('nd-scroll-m-20', props.className)}>
<a href={`#${props.id}`} className="nd-group nd-not-prose">
{props.children}
<span
aria-label="Link to section"
className="nd-ml-2 nd-font-medium nd-select-none nd-text-muted-foreground nd-opacity-0 nd-transition-opacity group-hover:nd-opacity-100"
>
#
</span>
</a>
</As>
)