mango-ui-v2/components/MenuItem.tsx

26 lines
639 B
TypeScript

import { useRouter } from 'next/router'
import Link from 'next/link'
const MenuItem = ({ href, children }) => {
const { asPath } = useRouter()
return (
<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 border-l-4 md:border-l-0 md:border-b-2 hover:text-th-primary hover:opacity-100
${
asPath === href
? `border-th-primary`
: `border-transparent hover:border-th-primary`
}
`}
>
{children}
</a>
</Link>
)
}
export default MenuItem