import { useEffect, type ReactNode } from 'react'; type ModalProps = { open: boolean; onClose: () => void; ariaLabel: string; title?: string; panelClassName?: string; bodyClassName?: string; children: ReactNode; }; export function Modal({ open, onClose, ariaLabel, title, panelClassName, bodyClassName, children, }: ModalProps) { useEffect(() => { if (!open) return; const handleKeyDown = (e: globalThis.KeyboardEvent) => { if (e.key === 'Escape') { e.preventDefault(); onClose(); } }; document.addEventListener('keydown', handleKeyDown); return () => document.removeEventListener('keydown', handleKeyDown); }, [open, onClose]); if (!open) return null; return (
event.stopPropagation()} >
{title ? (

{title}

) : null}
{children}
); }