import cn from 'classnames' import { FC, useRef } from 'react' import s from './Modal.module.css' import { useDialog } from '@react-aria/dialog' import { useOverlay, usePreventScroll, useModal } from '@react-aria/overlays' import { FocusScope } from '@react-aria/focus' interface Props { className?: string children?: any show?: boolean close: () => void } const Modal: FC = ({ className, children, show = true, close, ...props }) => { const rootClassName = cn(s.root, className) let ref = useRef() as React.MutableRefObject let { modalProps } = useModal() let { overlayProps } = useOverlay(props, ref) let { dialogProps } = useDialog(props, ref) usePreventScroll({ isDisabled: !show, }) return (
{children}
) } export default Modal