"use client"; import { Children, useEffect, useState, type ReactNode } from "react"; type Props = { open: boolean; onClose: () => void; title?: string; children: ReactNode; }; const PANEL_MS = 420; const ITEM_BASE_MS = 90; function CloseIcon({ className }: { className?: string }) { return ( ); } export function MobileSidebar({ open, onClose, title = "Menu", children }: Props) { const [mounted, setMounted] = useState(false); const [visible, setVisible] = useState(false); useEffect(() => { if (open) { setMounted(true); const frame = requestAnimationFrame(() => setVisible(true)); return () => cancelAnimationFrame(frame); } setVisible(false); const timer = window.setTimeout(() => setMounted(false), PANEL_MS); return () => window.clearTimeout(timer); }, [open]); useEffect(() => { if (!mounted) return; const onKeyDown = (e: KeyboardEvent) => { if (e.key === "Escape") onClose(); }; document.body.style.overflow = "hidden"; window.addEventListener("keydown", onKeyDown); return () => { document.body.style.overflow = ""; window.removeEventListener("keydown", onKeyDown); }; }, [mounted, onClose]); if (!mounted) return null; return (
); } export function MobileMenuButton({ onClick, open = false, }: { onClick: () => void; open?: boolean; }) { return ( ); } export function sidebarLinkClass(active = false) { return `block rounded-lg px-4 py-3 text-base font-medium transition-all duration-200 hover:translate-x-0.5 ${ active ? "bg-surface-light text-white" : "text-gray-300 hover:bg-surface-light hover:text-white" }`; } export function dashboardSidebarLinkClass(active = false, danger = false) { const classes = ["mobile-sidebar-link"]; if (active) classes.push("mobile-sidebar-link-active"); if (danger) classes.push("mobile-sidebar-link-danger"); return classes.join(" "); }