import { useEffect, type ReactNode } from 'react' import { AnimatePresence, motion } from 'motion/react' import { useT } from '@/i18n/useT' export interface DialogProps { open: boolean onClose: () => void title: string children: ReactNode size?: 'sm' | 'md' | 'lg' | 'xl' } const SIZE: Record, string> = { sm: 'max-w-sm', md: 'max-w-md', lg: 'max-w-2xl', xl: 'max-w-4xl', } export default function Dialog({ open, onClose, title, children, size = 'md', }: DialogProps) { const t = useT() useEffect(() => { if (!open) return const onKey = (e: KeyboardEvent) => e.key === 'Escape' && onClose() window.addEventListener('keydown', onKey) return () => window.removeEventListener('keydown', onKey) }, [open, onClose]) return ( {open && (

{title}

{children}
)}
) }