2021-03-30 15:47:08 -07:00
|
|
|
import { useRouter } from 'next/router'
|
|
|
|
import Link from 'next/link'
|
|
|
|
|
|
|
|
const MenuItem = ({ href, children }) => {
|
|
|
|
const { asPath } = useRouter()
|
|
|
|
|
|
|
|
return (
|
2021-04-15 13:06:42 -07:00
|
|
|
<Link href={href}>
|
2021-03-30 15:47:08 -07:00
|
|
|
<a
|
2021-04-15 14:54:42 -07:00
|
|
|
className={`block text-th-fgd-1 font-medium items-center pl-3 pr-4 py-2
|
2021-04-22 08:21:16 -07:00
|
|
|
sm:inline-flex sm:ml-4 sm:px-1 sm:py-0 border-l-4 sm:border-l-0 sm:border-b-2 text-base hover:text-th-primary
|
2021-04-12 09:49:02 -07:00
|
|
|
${
|
|
|
|
asPath === href
|
|
|
|
? `border-th-primary`
|
|
|
|
: `border-transparent hover:border-th-primary`
|
|
|
|
}
|
|
|
|
`}
|
2021-03-30 15:47:08 -07:00
|
|
|
>
|
|
|
|
{children}
|
|
|
|
</a>
|
|
|
|
</Link>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default MenuItem
|