import React, { useEffect } from 'react';
import ReactDOM from 'react-dom';
import cn from 'classnames';
import { useHistory } from 'react-router';
import ModalOverlay from './ModalOverlay';
const DEFAULT_WIDTH = 350;
interface Props {
component: any;
className?: string;
props: any;
hideModal?: boolean;
width?: number;
}
function Modal({ component, className = 'bg-white', props, hideModal }: Props) {
const history = useHistory();
useEffect(() =>
history.listen((location) => {
if (history.action === 'POP') {
document.querySelector('body').style.overflow = 'visible';
}
}),
);
return component ? (
ReactDOM.createPortal(