"use client"; import { useEffect } from "react"; type Props = { title: string; titleIcon?: React.ReactNode; subtitle?: string; onClose: () => void; children: React.ReactNode; maxWidth?: string; /** Compact mode: tighter padding, smaller title, no accent bar — for dense forms. */ compact?: boolean; /** Optional eyebrow text rendered above the title in compact mode. */ eyebrow?: string; }; export default function GlassModal({ title, titleIcon, subtitle, onClose, children, maxWidth = "max-w-lg", compact = false, eyebrow, }: 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 (
{eyebrow}
)}{subtitle}
)}