import { ReactNode, useEffect, useState } from 'react' import { X } from 'lucide-react' import clsx from 'clsx' interface ModalProps { open: boolean onClose: () => void title?: string children: ReactNode className?: string size?: 'sm' | 'md' | 'lg' | 'xl' } export default function Modal({ open, onClose, title, children, className, size = 'md' }: ModalProps) { const [show, setShow] = useState(false) useEffect(() => { if (open) { document.body.style.overflow = 'hidden' requestAnimationFrame(() => setShow(true)) } else { document.body.style.overflow = '' setShow(false) } return () => { document.body.style.overflow = '' } }, [open]) if (!open) return null return (
{title && (

{title}

)}
{children}
) }