blog.z0x.ca/src/components/Link.astro
2024-09-12 13:03:09 -07:00

35 lines
566 B
Text

---
import { cn } from '@lib/utils'
type Props = {
href: string
external?: boolean
class?: string
underline?: boolean
'data-heading'?: string
[key: string]: any
}
const {
href,
external,
class: className,
underline,
'data-heading': dataHeading,
...rest
} = Astro.props
---
<a
href={href}
target={external ? '_blank' : '_self'}
class={cn(
'inline-block transition-colors duration-300 ease-in-out',
underline && 'underline underline-offset-[3px]',
className,
)}
data-heading={dataHeading}
{...rest}
>
<slot />
</a>