UNPKG

@kadconsulting/dry

Version:
17 lines 644 B
import { jsx as _jsx } from "react/jsx-runtime"; import './MobileNavContainer.scss'; import { useEffect } from 'react'; const MobileNavContainer = ({ children, open }) => { /** Prevent vertical scroll of the body when the mobile nav is open. */ useEffect(() => { if (open) { document.body.style.overflow = 'hidden'; } else { document.body.style.overflow = 'unset'; } }, [open]); return (_jsx("div", { className: `mobile-nav-container ${open ? 'open' : 'closed'}`, children: children })); }; export default MobileNavContainer; //# sourceMappingURL=MobileNavContainer.js.map