Skip to content

Commit

Permalink
fix(components/navigation/bar): hide hamburger menu on homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
Mnigos committed Nov 17, 2024
1 parent 8ec53a2 commit 06fd3d8
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 25 deletions.
4 changes: 4 additions & 0 deletions app/components/navigation/navigation-bar.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import { NavigationBar } from './navigation-bar'

import { QueryClientWrapper } from '@tests/utils'

vi.mock('next/navigation', () => ({
usePathname: vi.fn().mockReturnValue('/profile'),
}))

describe('NavigationBar', () => {
test('should match snapshot as unauthenticated', () => {
const view = render(<NavigationBar />, {
Expand Down
52 changes: 27 additions & 25 deletions app/components/navigation/navigation-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,33 +63,35 @@ function NavigationBar({ user, userId }: NavigationBar.Props) {
className="hidden rounded-lg lg:block"
/>

<div className="h-[28px] w-[28px] lg:hidden">
<Sheet
open={isSidebarOpen}
onOpenChange={isOpen => {
setIsSidebarOpen(isOpen)
}}
>
<SheetTrigger
onClick={() => {
setIsSidebarOpen(true)
{pathname.includes('profile') && (
<div className="h-[28px] w-[28px] lg:hidden">
<Sheet
open={isSidebarOpen}
onOpenChange={isOpen => {
setIsSidebarOpen(isOpen)
}}
className="cursor-pointer"
>
{isSidebarOpen ? (
<IoClose size={28} />
) : (
<RxHamburgerMenu size={28} />
)}
</SheetTrigger>

<SheetContent side="bottom">
<div className="min-h-[50vh]">
<Sidebar />
</div>
</SheetContent>
</Sheet>
</div>
<SheetTrigger
onClick={() => {
setIsSidebarOpen(true)
}}
className="cursor-pointer"
>
{isSidebarOpen ? (
<IoClose size={28} />
) : (
<RxHamburgerMenu size={28} />
)}
</SheetTrigger>

<SheetContent side="bottom">
<div className="min-h-[50vh]">
<Sidebar />
</div>
</SheetContent>
</Sheet>
</div>
)}

<h1 className="hidden text-2xl font-semibold md:block md:text-3xl">
rigtch.fm
Expand Down

0 comments on commit 06fd3d8

Please sign in to comment.