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