"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 (
e.target === e.currentTarget && onClose()} style={{ backgroundColor: "rgba(60, 56, 37, 0.5)" }} >
{/* Accent bar */}
{/* Header */}

{title}

{subtitle &&

{subtitle}

}
{/* Content */}
{children}
); }