import clsx from 'clsx'; import React, { ReactNode, useEffect } from 'react'; import { MdArrowBackIosNew } from 'react-icons/md'; import { useResponsiveSize } from '@/hooks/useResponsiveSize'; interface DialogProps { id?: string; isOpen: boolean; children: ReactNode; header?: ReactNode; title?: string; className?: string; boxClassName?: string; contentClassName?: string; onClose: () => void; } const Dialog: React.FC = ({ id, isOpen, children, header, title, className, boxClassName, contentClassName, onClose, }) => { const iconSize22 = useResponsiveSize(22); const handleKeyDown = (event: KeyboardEvent) => { if (event.key === 'Escape') { onClose(); } }; useEffect(() => { window.addEventListener('keydown', handleKeyDown); return () => { window.removeEventListener('keydown', handleKeyDown); }; // eslint-disable-next-line react-hooks/exhaustive-deps }, []); return (
{header ? ( header ) : (
{title ?? ''}
)}
{children}
); }; export default Dialog;