mirror of
https://github.com/r-freeman/portfolio.git
synced 2025-04-11 20:54:31 +00:00
Fix heading component
All checks were successful
Build And Publish / BuildAndPublish (push) Successful in 3m15s
All checks were successful
Build And Publish / BuildAndPublish (push) Successful in 3m15s
This commit is contained in:
parent
e5eae13468
commit
f4e920bff4
@ -10,7 +10,7 @@ type HeadingProps = {
|
||||
}
|
||||
|
||||
export function Heading({as: Component = 'h1', children = null}: HeadingProps) {
|
||||
const ref = useRef<HTMLAnchorElement>(null);
|
||||
const ref = useRef<HTMLAnchorElement>(null)
|
||||
const headingText = children?.toString() || ''
|
||||
|
||||
useEffect(() => {
|
||||
@ -20,9 +20,9 @@ export function Heading({as: Component = 'h1', children = null}: HeadingProps) {
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<Component id={createSlug(headingText)} className="flex group">
|
||||
<Component id={createSlug(headingText)} className="group">
|
||||
{children}
|
||||
<Link className="sr-only group-hover:not-sr-only !ml-1.5" href={`#${createSlug(headingText)}`} ref={ref}></Link>
|
||||
<Link className="ml-1.5 invisible group-hover:visible" href={`#${createSlug(headingText)}`} ref={ref}></Link>
|
||||
</Component>
|
||||
)
|
||||
}
|
Loading…
Reference in New Issue
Block a user