1 parent
0c8d74b21d
commit
a1e51e78f0
23 files changed
+522
-516
No files matched your search
@@ -1,3 +1,5 @@
|
||||
"use client"
|
||||
|
||||
import s from "./nav.module.css"
|
||||
|
||||
import { Menu } from "../Menu"
|
||||
@@ -8,7 +10,7 @@ import { Spacer } from "../Spacer"
|
||||
import HudozkaLogo from "../HudozkaLogo"
|
||||
import { HudozkaTitle } from "../HudozkaTitle"
|
||||
import Link from "next/link"
|
||||
import { useRouter } from "next/router"
|
||||
import { usePathname } from "next/navigation"
|
||||
import { HiOutlineMenuAlt4, HiOutlineX } from "react-icons/hi"
|
||||
|
||||
export type MobileNavigationProps = {
|
||||
@@ -19,7 +21,7 @@ export type MobileNavigationProps = {
|
||||
export function MobileNavigation({ className, style }: MobileNavigationProps) {
|
||||
const menu = useContext(MenuContext)
|
||||
const detailsRef = useRef<HTMLDetailsElement>(null)
|
||||
const router = useRouter()
|
||||
const pathname = usePathname()
|
||||
|
||||
const close = useCallback(() => {
|
||||
if (detailsRef.current) {
|
||||
@@ -28,11 +30,8 @@ export function MobileNavigation({ className, style }: MobileNavigationProps) {
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
router.events.on("routeChangeStart", close)
|
||||
return () => {
|
||||
router.events.off("routeChangeStart", close)
|
||||
}
|
||||
}, [router.events, close])
|
||||
close()
|
||||
}, [pathname, close])
|
||||
|
||||
return (
|
||||
<nav className={className}>
|
||||
|
||||
Reference in new issue
Block a user