import { Fragment, ReactNode } from 'react'; import classnames from 'classnames'; import { ANIMATION_STATE, useAnimation } from './animation/AnimationContext'; import styles from './Backdrop.css'; type Props = { children?: ReactNode; closeOnOutsideClick: boolean; onClick?: (event: React.MouseEvent) => void; }; function Backdrop({ children, closeOnOutsideClick, onClick }: Props) { const { animationState } = useAnimation(); return ( {/* Disabling the linters below is fine, we don't want key event listeners (ESC handled elsewhere) */} {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions */}
{ if (event.target !== event.currentTarget) return; onClick?.(event); }} /> {children} ); } export default Backdrop;