'use client' import { useEffect } from 'react' import { X } from 'lucide-react' import { Button } from './button' interface ModalProps { open: boolean onClose: () => void title: string children: React.ReactNode footer?: React.ReactNode width?: 'sm' | 'md' | 'lg' } export function Modal({ open, onClose, title, children, footer, width = 'md' }: ModalProps) { useEffect(() => { if (!open) return const onKey = (e: KeyboardEvent) => { if (e.key === 'Escape') onClose() } document.addEventListener('keydown', onKey) return () => document.removeEventListener('keydown', onKey) }, [open, onClose]) if (!open) return null const maxW = { sm: 'max-w-sm', md: 'max-w-md', lg: 'max-w-lg' }[width] return (