import { XIcon } from '@heroicons/react/outline' import React, { ReactNode, useRef } from 'react' import { useClickAway, useKey, useKeyPress, useKeyPressEvent } from 'react-use' import Button from './Button' export interface ModalProps { show: boolean children?: ReactNode onClose?: () => void title: string className?: string } export default function Modal(props: ModalProps) { const { show, children, onClose, className, title } = props const ref = useRef(null) useClickAway(ref, () => { onClose?.() }) useKeyPressEvent('Escape', e => { onClose?.() }) return (

{title}

{children}
) }