import { useEffect, type ReactNode } from 'react'; interface DrawerProps { open: boolean; onClose: () => void; title?: ReactNode; children: ReactNode; width?: number; } export function Drawer({ open, onClose, title, children, width = 560 }: DrawerProps) { useEffect(() => { if (!open) return; const handler = (e: KeyboardEvent) => { if (e.key === 'Escape') onClose(); }; window.addEventListener('keydown', handler); return () =>{ window.removeEventListener('keydown', handler); }; }, [open, onClose]); if (!open) return null; return (
); }