import React from 'react'; import Icon from './Icon'; import useOnKey from '../../hooks/useOnKey'; type ModalProps = { children: React.ReactNode, width?: string, title?: string, verticalCenter?: boolean, closeModal: Function, } const Modal = ({ children, width = '1/2', closeModal, title, verticalCenter = false }:ModalProps) => { useOnKey('Escape', closeModal); const closeOnBGClick = (e:React.SyntheticEvent) => { e.stopPropagation(); e.nativeEvent.stopImmediatePropagation(); if (e.target === e.currentTarget) { closeModal(); } }; return (