import React from "react"; import Modal from "react-modal"; import { useThemeUI, Close } from "theme-ui"; function StyledModal({ isOpen, onRequestClose, children, allowClose, ...props }) { const { theme } = useThemeUI(); return ( {/* Stop keyboard events when modal is open to prevent shortcuts from triggering */}
e.stopPropagation()} onKeyUp={(e) => e.stopPropagation()} > {children} {allowClose && ( )}
); } StyledModal.defaultProps = { allowClose: true, }; export default StyledModal;