import React, { useEffect } from 'react' import { X } from 'lucide-react' interface ModalProps { isOpen: boolean onClose: () => void title: React.ReactNode children: React.ReactNode maxWidth?: | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl' | '7xl' } const Modal: React.FC = ({ isOpen, onClose, title, children, maxWidth = '4xl' }) => { useEffect(() => { const handleEscape = (e: KeyboardEvent) => { if (e.key === 'Escape') { onClose() } } if (isOpen) { document.addEventListener('keydown', handleEscape) document.body.style.overflow = 'hidden' } return () => { document.removeEventListener('keydown', handleEscape) document.body.style.overflow = 'unset' } }, [isOpen, onClose]) if (!isOpen) return null const maxWidthClasses = { sm: 'max-w-sm', md: 'max-w-md', lg: 'max-w-lg', xl: 'max-w-xl', '2xl': 'max-w-2xl', '3xl': 'max-w-3xl', '4xl': 'max-w-4xl', '5xl': 'max-w-5xl', '6xl': 'max-w-6xl', '7xl': 'max-w-7xl' } return (
{/* Backdrop */}
{/* Modal */}
e.stopPropagation()} > {/* Header */}

{title}

{/* Content */}
{children}
) } export default Modal