2021-12-30 20:03:32 +00:00
|
|
|
import clsx from 'clsx'
|
|
|
|
import Link from 'next/link'
|
|
|
|
|
|
|
|
export const SiteLink = (props: {
|
|
|
|
href: string
|
|
|
|
children: any
|
|
|
|
className?: string
|
|
|
|
}) => {
|
|
|
|
const { href, children, className } = props
|
|
|
|
|
2021-12-31 19:17:32 +00:00
|
|
|
return href.startsWith('http') ? (
|
|
|
|
<a
|
|
|
|
href={href}
|
|
|
|
className={clsx(
|
2022-01-26 18:44:16 +00:00
|
|
|
'hover:underline hover:decoration-indigo-400 hover:decoration-2 z-10',
|
2021-12-31 19:17:32 +00:00
|
|
|
className
|
|
|
|
)}
|
|
|
|
onClick={(e) => e.stopPropagation()}
|
|
|
|
>
|
|
|
|
{children}
|
|
|
|
</a>
|
|
|
|
) : (
|
2021-12-30 20:03:32 +00:00
|
|
|
<Link href={href}>
|
|
|
|
<a
|
|
|
|
className={clsx(
|
2022-01-26 18:44:16 +00:00
|
|
|
'hover:underline hover:decoration-indigo-400 hover:decoration-2 z-10',
|
2021-12-30 20:03:32 +00:00
|
|
|
className
|
|
|
|
)}
|
|
|
|
onClick={(e) => e.stopPropagation()}
|
|
|
|
>
|
|
|
|
{children}
|
|
|
|
</a>
|
|
|
|
</Link>
|
|
|
|
)
|
|
|
|
}
|