mirror of
				https://github.com/r-freeman/portfolio.git
				synced 2025-11-04 15:51:11 +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) {
 | 
			
		||||
    const ref = useRef<HTMLAnchorElement>(null);
 | 
			
		||||
    const ref = useRef<HTMLAnchorElement>(null)
 | 
			
		||||
    const headingText = children?.toString() || ''
 | 
			
		||||
 | 
			
		||||
    useEffect(() => {
 | 
			
		||||
@ -22,7 +22,7 @@ export function Heading({as: Component = 'h1', children = null}: HeadingProps) {
 | 
			
		||||
    return (
 | 
			
		||||
        <Component id={createSlug(headingText)} className="flex 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…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user