'use client'; import { useEffect } from 'react'; import { X } from 'lucide-react'; import { Button } from './button'; interface ModalProps { isOpen: boolean; onClose: () => void; title: string; children: React.ReactNode; } export function Modal({ isOpen, onClose, title, children }: ModalProps) { // Close on escape key useEffect(() => { const handleEscape = (e: KeyboardEvent) => { if (e.key === 'Escape') onClose(); }; if (isOpen) { document.addEventListener('keydown', handleEscape); // Prevent scrolling when modal is open document.body.style.overflow = 'hidden'; } return () => { document.removeEventListener('keydown', handleEscape); document.body.style.overflow = 'unset'; }; }, [isOpen, onClose]); if (!isOpen) return null; return (