"use client"; import Link from "next/link"; import { Menu, X } from "lucide-react"; import { useId, useRef, useState } from "react"; interface NavigationItem { title: string; href: string; newTab: boolean; } export default function MobileNavigation({ items }: { items: NavigationItem[] }) { const [isOpen, setIsOpen] = useState(false); const menuId = useId(); const toggleRef = useRef(null); const label = isOpen ? "关闭导航菜单" : "打开导航菜单"; return (
{ if (event.key === "Escape" && isOpen) { setIsOpen(false); toggleRef.current?.focus(); } }} >
); }