import { FC, useMemo } from "react"; import { createPortal } from "react-dom"; import { Classes, Dialog, DialogProps } from "@blueprintjs/core"; import { useExtensionContext } from "Components/App"; import { CustomClasses } from "../../constants"; import "./_index.sass"; type OwnProps = { ariaLabelledBy: DialogProps["aria-labelledby"], className: string, onClose: () => void }; export type DialogOverlayProps = OwnProps & Pick; const DialogOverlay: FC = (props) => { const { ariaLabelledBy, children, className: dialogClass, isOpen, lazy = true, onClose, onOpening, ...otherProps } = props; const { portalId } = useExtensionContext(); const dialog_class = useMemo(() => CustomClasses.PREFIX_DIALOG_OVERLAY + dialogClass, [dialogClass]); const mainPanelStyle = useMemo(() => { return { flex: "1 1 100%" }; }, []); return ( createPortal(
{children}
, document.getElementById(portalId)!) ); }; export default DialogOverlay;