manifold/web/components/site-link.tsx
2022-02-14 20:27:43 -06:00

38 lines
891 B
TypeScript

import clsx from 'clsx'
import Link from 'next/link'
export const SiteLink = (props: {
href: string
children: any
className?: string
}) => {
const { href, children, className } = props
return href.startsWith('http') ? (
<a
href={href}
className={clsx(
'break-words z-10 hover:underline hover:decoration-indigo-400 hover:decoration-2',
className
)}
style={{ /* For iOS safari */ wordBreak: 'break-word' }}
onClick={(e) => e.stopPropagation()}
>
{children}
</a>
) : (
<Link href={href}>
<a
className={clsx(
'break-words z-10 hover:underline hover:decoration-indigo-400 hover:decoration-2',
className
)}
style={{ /* For iOS safari */ wordBreak: 'break-word' }}
onClick={(e) => e.stopPropagation()}
>
{children}
</a>
</Link>
)
}