"use client"; import { useState, useEffect } from "react"; import { createPortal } from "react-dom"; import Link from "next/link"; import { NavIcon } from "./ui"; import { useTranslation } from "../../lib/i18n/context"; type NavItem = { href: "/" | "/books" | "/series" | "/libraries" | "/jobs" | "/tokens" | "/settings"; label: string; icon: "dashboard" | "books" | "series" | "libraries" | "jobs" | "tokens" | "settings"; }; const HamburgerIcon = () => ( ); const XIcon = () => ( ); export function MobileNav({ navItems }: { navItems: NavItem[] }) { const { t } = useTranslation(); const [isOpen, setIsOpen] = useState(false); const [mounted, setMounted] = useState(false); useEffect(() => { setMounted(true); }, []); const overlay = ( <> {/* Backdrop */}
setIsOpen(false)} aria-hidden="true" /> {/* Drawer */}
{t("nav.navigation")}
); return ( <> {/* Hamburger button — reste dans le header */} {/* Backdrop + Drawer portés directement sur document.body, hors du header et de son backdrop-filter */} {mounted && createPortal(overlay, document.body)} ); }