import { ReactNode } from "react"; import ReactDOM from "react-dom"; import { CSSTransition } from "react-transition-group"; import "./Dialog.css"; const optionalPortalElement = document.getElementById("portal"); if (optionalPortalElement == null) { throw new Error("Portal element not found"); } const portalElement = optionalPortalElement; interface DialogProps { onClose: () => void; open: boolean; children?: ReactNode; disableCloseOnClickOnOverlay?: boolean; } export default function Dialog(props: DialogProps) { const { open, onClose, children, disableCloseOnClickOnOverlay } = props; return ReactDOM.createPortal(
{ onClose(); } } >
e.stopPropagation()} > {children}
, portalElement, ); }