mirror of
https://github.com/documenso/documenso.git
synced 2025-11-25 14:11:43 +10:00
move menu links to map, add window-size hook
This commit is contained in:
@ -6,19 +6,25 @@ import { Menu, X } from 'lucide-react';
|
||||
|
||||
import { Button } from '@documenso/ui/primitives/button';
|
||||
|
||||
import { useWindowSize } from '~/hooks/use-window-size';
|
||||
|
||||
export interface HamburgerMenuProps {
|
||||
isMenuOpen: boolean;
|
||||
menuToggle: () => void;
|
||||
}
|
||||
|
||||
export const HamburgerMenu = ({ isMenuOpen, menuToggle }: HamburgerMenuProps) => {
|
||||
const { width } = useWindowSize();
|
||||
|
||||
useEffect(() => {
|
||||
// Update document.body.style.overflow based on the menu state
|
||||
// and check that the window width is less than 768px
|
||||
// if (window.innerWidth < 768) {
|
||||
// document.body.style.overflow = isMenuOpen ? 'hidden' : 'auto';
|
||||
// }
|
||||
}, [isMenuOpen]);
|
||||
// If the window width is less than 768px, we want to prevent scrolling when the menu is open
|
||||
if (width < 768 && isMenuOpen) {
|
||||
document.body.style.overflow = 'hidden';
|
||||
} else {
|
||||
document.body.style.overflow = 'auto';
|
||||
}
|
||||
}, [isMenuOpen, width]);
|
||||
|
||||
return (
|
||||
<div className="flex md:hidden">
|
||||
|
||||
Reference in New Issue
Block a user