import { FC, PropsWithChildren, useEffect, useRef } from 'react'; interface DialogProps { visible: boolean; closeDialog: () => void; } const Dialog: FC> = ({ visible, closeDialog, children, }) => { const dialogRef = useRef(null); useEffect(() => { if (visible) { dialogRef.current?.showModal(); } else { dialogRef.current?.close(); } }, [visible]); const handleButtonClick = (e: React.MouseEvent) => { e.preventDefault(); closeDialog(); }; return (
{children}
); }; export default Dialog;