From e7a283f188240f96fad0d0b70daf6c0aa9c7a0aa Mon Sep 17 00:00:00 2001 From: sk1982 Date: Sun, 17 Mar 2024 19:11:05 -0400 Subject: [PATCH] hide header on mobile scroll --- src/components/header-sidebar.tsx | 67 +++++++++++++++++-------------- 1 file changed, 36 insertions(+), 31 deletions(-) diff --git a/src/components/header-sidebar.tsx b/src/components/header-sidebar.tsx index 0ea3dc3..75ab7c8 100644 --- a/src/components/header-sidebar.tsx +++ b/src/components/header-sidebar.tsx @@ -1,6 +1,6 @@ 'use client'; -import { Button, Divider } from '@nextui-org/react'; +import { Button, Divider, Navbar } from '@nextui-org/react'; import { Bars3Icon, ChevronLeftIcon, XMarkIcon } from '@heroicons/react/20/solid'; import { Fragment, useState } from 'react'; import Link from 'next/link'; @@ -11,6 +11,7 @@ import { usePathname, useRouter, useSearchParams } from 'next/navigation'; import { UserPayload } from '@/types/user'; import { MAIN_ROUTES, ROUTES, UserOnly } from '@/routes'; import { useUser } from '@/helpers/use-user'; +import { useBreakpoint } from '@/helpers/use-breakpoint'; export type HeaderSidebarProps = { children?: React.ReactNode @@ -27,6 +28,7 @@ export const HeaderSidebar = ({ children }: HeaderSidebarProps) => { const path = usePathname(); const params = useSearchParams(); const [isMenuOpen, setMenuOpen] = useState(false); + const breakpoint = useBreakpoint(); const from = params?.get('from'); const filter = filterUserOnly.bind(null, user); @@ -82,38 +84,41 @@ export const HeaderSidebar = ({ children }: HeaderSidebarProps) => {
-
- -
- {routeGroup.routes?.filter(filter).map(route => - - {route.name} - ) - } -
- {routeGroup !== MAIN_ROUTES &&
- {MAIN_ROUTES.routes.filter(filter).map(route => - {route.name} - )} -
} -
- - {user && } - - - +
+ {routeGroup.routes?.filter(filter).map(route => + + {route.name} + ) + } +
+ {routeGroup !== MAIN_ROUTES &&
+ {MAIN_ROUTES.routes.filter(filter).map(route => + {route.name} + )} +
} +
+ + {user && } + + + +
-
+ +
{children}