mirror of
https://github.com/r-freeman/portfolio.git
synced 2024-11-21 20:45:41 +00:00
Fix ts issue
All checks were successful
Build And Publish / BuildAndPublish (push) Successful in 2m36s
All checks were successful
Build And Publish / BuildAndPublish (push) Successful in 2m36s
This commit is contained in:
parent
efbac85b5a
commit
3a5de79115
@ -1,4 +1,3 @@
|
||||
// @ts-nocheck
|
||||
import {ElementType, ReactNode} from 'react'
|
||||
import {createSlug} from '@/lib/createSlug'
|
||||
import Link from 'next/link'
|
||||
@ -8,12 +7,14 @@ type HeadingProps = {
|
||||
children: ReactNode
|
||||
}
|
||||
|
||||
export function Heading({as: Component = 'h1', children}: HeadingProps) {
|
||||
export function Heading({as: Component = 'h1', children = null}: HeadingProps) {
|
||||
let headingText = children ? children.toString() : ''
|
||||
|
||||
return (
|
||||
<Component id={createSlug(children.toString())} className='group'>
|
||||
<Component id={createSlug(headingText)} className='group'>
|
||||
{children}
|
||||
<Link className='ml-1 group-hover:opacity-100 opacity-0 transition-opacity ease-in'
|
||||
href={`#${createSlug(children.toString())}`}>#</Link>
|
||||
href={`#${createSlug(headingText)}`}>#</Link>
|
||||
</Component>
|
||||
)
|
||||
}
|
Loading…
Reference in New Issue
Block a user