import { useState, useEffect } from 'react'; import ReactDOM from 'react-dom' import {Icon} from '@rmwc/icon' import FocusTrap from 'focus-trap-react' import styles from './modal.module.css' export default function Modal({visible, title, children, onDeactivate}){ const [portalExists, setPortalExists] = useState(false); useEffect(() => { const portalExists = !!document.querySelector('#sos-modal'); if (!portalExists) { const portal = document.createElement('div'); portal.id = '#sos-modal'; document.body.appendChild(portal); } setPortalExists(true); }, []); if(!portalExists) return null return ReactDOM.createPortal((