/** * External dependencies */ import { Modal } from '@wordpress/components'; import { useDebounce } from 'use-debounce'; import classNames from 'classnames'; /** * Internal dependencies */ import './style.scss'; interface DrawerProps { children: JSX.Element; className?: string; isOpen: boolean; onClose: () => void; slideIn?: boolean; slideOut?: boolean; title: string; } const Drawer = ( { children, className, isOpen, onClose, slideIn = true, slideOut = true, title, }: DrawerProps ): JSX.Element | null => { const [ debouncedIsOpen ] = useDebounce< boolean >( isOpen, 300 ); const isClosing = ! isOpen && debouncedIsOpen; if ( ! isOpen && ! isClosing ) { return null; } return ( { children } ); }; export default Drawer;