import FocusTrap from 'focus-trap-react' import React, { useEffect } from 'react' import * as animate from 'Ui/animate' import { LinkButton } from 'Ui/Button' import './Overlay.css' type OverlayProps = React.HTMLAttributes & { onClose?: () => void children: React.ReactNode } export default function Overlay({ onClose, children, ...otherProps }: OverlayProps) { useEffect(() => { const body = document.getElementsByTagName('body')[0] body.classList.add('no-scroll') return () => { body.classList.remove('no-scroll') } }, []) return (
{children} {onClose && ( × )}
) }