Skip to content

Commit

Permalink
fix: error with not closing sheet on page select
Browse files Browse the repository at this point in the history
  • Loading branch information
kujo205 committed Jan 31, 2024
1 parent 388ea70 commit ea27ab1
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions src/components/navagiation/mobile-header.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
"use client";
import { usePathname } from "next/navigation";
import { Sheet, SheetContent, SheetTrigger } from "@/components/ui/sheet";
import {
Sheet,
SheetClose,
SheetContent,
SheetTrigger,
} from "@/components/ui/sheet";
import { Button, buttonVariants } from "@/components/ui/button";
import { Icons } from "@/components/icons";
import { header } from "@/config/general";
Expand All @@ -21,15 +26,17 @@ export const OpenMobileHeaderButtonAndMobileHeader = () => {
<SheetContent>
<nav className="flex flex-col">
{header.map((navItem) => (
<Link href={navItem.url} key={navItem.url}>
<Button
variant={navItem.url === pathname ? "ghost-hovered" : "ghost"}
size="lg"
className="items-center"
>
{navItem.name}
</Button>
</Link>
<SheetClose asChild key={navItem.url}>
<Link href={navItem.url}>
<Button
variant={navItem.url === pathname ? "ghost-hovered" : "ghost"}
size="lg"
className="items-center"
>
{navItem.name}
</Button>
</Link>
</SheetClose>
))}
</nav>
</SheetContent>
Expand Down

0 comments on commit ea27ab1

Please sign in to comment.