mango-ui-v3/components/MenuItem.tsx

28 lines
705 B
TypeScript
Raw Normal View History

import { useRouter } from 'next/router'
import Link from 'next/link'
2021-08-16 11:20:19 -07:00
const MenuItem = ({ href, children, newWindow }) => {
const { asPath } = useRouter()
return (
2021-04-15 13:06:42 -07:00
<Link href={href}>
<a
className={`block text-th-fgd-1 font-bold items-center pl-3 pr-4 py-2
md:inline-flex md:ml-4 md:px-1 md:py-0 hover:text-th-primary hover:opacity-100
${
asPath === href
? `text-th-primary`
: `border-transparent hover:border-th-primary`
}
`}
2021-08-16 11:20:19 -07:00
target={newWindow ? '_blank' : ''}
rel={newWindow ? 'noopener noreferrer' : ''}
>
{children}
</a>
</Link>
)
}
export default MenuItem