manifold/web/components/site-link.tsx
Austin Chen 7338bdd47a
Automatically sort Tailwind classes with Prettier (#45)
* Add Prettier Tailwind plugin

* Autoformat Tailwind classes with Prettier
2022-02-11 10:40:22 -08:00

36 lines
739 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(
'z-10 hover:underline hover:decoration-indigo-400 hover:decoration-2',
className
)}
onClick={(e) => e.stopPropagation()}
>
{children}
</a>
) : (
<Link href={href}>
<a
className={clsx(
'z-10 hover:underline hover:decoration-indigo-400 hover:decoration-2',
className
)}
onClick={(e) => e.stopPropagation()}
>
{children}
</a>
</Link>
)
}