Skip to content

Commit

Permalink
add toggleMenu event on click
Browse files Browse the repository at this point in the history
  • Loading branch information
firehawk89 committed Jan 26, 2024
1 parent 1a96a98 commit efb5dd6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/components/header/menu/menu-item.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
'use client'

import HeaderContext from '@/store/header-context'
import Link from 'next/link'
import { FC, ReactNode } from 'react'
import { FC, ReactNode, useContext } from 'react'

type MenuItemProps = {
children: ReactNode
Expand All @@ -8,8 +11,10 @@ type MenuItemProps = {
}

const MenuItem: FC<MenuItemProps> = ({ children, className, href }) => {
const { toggleMenu } = useContext(HeaderContext)

return (
<li className={className}>
<li className={className} onClick={toggleMenu}>
<Link
className="text-lg font-medium uppercase transition-colors md:hover:text-accent"
href={href}
Expand Down

0 comments on commit efb5dd6

Please sign in to comment.