"use client"; import { useEffect } from "react"; type Props = { title: string; subtitle?: string; onClose: () => void; children: React.ReactNode; maxWidth?: string; }; export default function AdminModal({ title, subtitle, onClose, children, maxWidth = "max-w-md" }: Props) { useEffect(() => { document.body.style.overflow = "hidden"; return () => { document.body.style.overflow = ""; }; }, []); useEffect(() => { const handleEscape = (e: KeyboardEvent) => { if (e.key === "Escape") onClose(); }; window.addEventListener("keydown", handleEscape); return () => window.removeEventListener("keydown", handleEscape); }, [onClose]); return (
{subtitle}
}