Skip to content

Commit

Permalink
fix: scroll when mobile modal is open
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh DeCristi committed Apr 25, 2023
1 parent edac3d1 commit 5e32dc9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/layouts/components/DrawerWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Drawer } from '@mui/material';
import { ReactNode } from 'react';
import { ReactNode, useEffect } from 'react';

interface DrawerWrapperProps {
open: boolean;
Expand All @@ -9,6 +9,10 @@ interface DrawerWrapperProps {
}

export const DrawerWrapper = ({ open, setOpen, children, headerHeight }: DrawerWrapperProps) => {
useEffect(() => {
document.body.style.overflow = open ? 'hidden' : 'auto';
});

return (
<Drawer
data-cy={`mobile-menu`}
Expand Down

0 comments on commit 5e32dc9

Please sign in to comment.