mirror of
https://github.com/r-freeman/portfolio.git
synced 2025-04-19 12:24:46 +00:00
Fix heading component
All checks were successful
Build And Publish / BuildAndPublish (push) Successful in 3m14s
All checks were successful
Build And Publish / BuildAndPublish (push) Successful in 3m14s
This commit is contained in:
parent
e5eae13468
commit
22bf99d44b
@ -10,7 +10,7 @@ type HeadingProps = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function Heading({as: Component = 'h1', children = null}: HeadingProps) {
|
export function Heading({as: Component = 'h1', children = null}: HeadingProps) {
|
||||||
const ref = useRef<HTMLAnchorElement>(null);
|
const ref = useRef<HTMLAnchorElement>(null)
|
||||||
const headingText = children?.toString() || ''
|
const headingText = children?.toString() || ''
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -22,7 +22,7 @@ export function Heading({as: Component = 'h1', children = null}: HeadingProps) {
|
|||||||
return (
|
return (
|
||||||
<Component id={createSlug(headingText)} className="flex group">
|
<Component id={createSlug(headingText)} className="flex group">
|
||||||
{children}
|
{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>
|
</Component>
|
||||||
)
|
)
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user