diff --git a/apps/frontend/components/Header.tsx b/apps/frontend/components/Header.tsx index 4a2df28..9e9a42f 100644 --- a/apps/frontend/components/Header.tsx +++ b/apps/frontend/components/Header.tsx @@ -3,7 +3,7 @@ import { cn } from "@/lib/utils"; import Link from "next/link"; import { usePathname, useRouter } from "next/navigation"; -import { useState } from "react"; +import { useEffect, useRef, useState } from "react"; import { Drawer, DrawerContent, @@ -29,81 +29,100 @@ export default function Header() { ]; const handleClick = (e: React.MouseEvent, path: string) => { - e.preventDefault(); if (path === '/console') { + e.preventDefault(); const token = typeof window !== 'undefined' ? localStorage.getItem('token') : null; router.push(token ? '/console' : '/console/login'); + setShowMenu(false); } else { - router.push(path); + setShowMenu(false); } - setShowMenu(false); } + const menuButtonRef = useRef(null); + useEffect(() => { + if (!showMenu && menuButtonRef.current) { + menuButtonRef.current.focus(); + } + }, [showMenu]); + return ( -
-
- - {pathname === "/" - ?
๐Ÿญ
- :
็‰นๆฉ(TONE)
} - + <> +
+
+ + ็‰นๆฉ(TONE) + {pathname === "/" + ? + : } + + - !state && setShowMenu(false)}> - -
setShowMenu(true)}> - ่œๅ• -
-
- - - - ่œๅ• - setShowMenu(false)} /> - - ่ฏท้€‰ๆ‹ฉ้œ€่ฆๅ‰ๅพ€็š„้กต้ข - -
- {menuItems.slice(1).map((item) => ( - handleClick(e, item.path)} - > - - - ))} -
-
-
- -
- {menuItems.slice(1).map((item) => ( - handleClick(e, item.path)} - > - {item.name} - - ))} +
-
-
+
+ + + + + + ่œๅ• + + + ่ฏท้€‰ๆ‹ฉ้œ€่ฆๅ‰ๅพ€็š„้กต้ข + + + + + ) }