Skip to content

Commit

Permalink
Add close trigger to mobile menu links
Browse files Browse the repository at this point in the history
  • Loading branch information
FoggyMtnDrifter committed Apr 8, 2024
1 parent 947cef9 commit 2892e4f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 14 deletions.
11 changes: 9 additions & 2 deletions app/[locale]/components/header/MobileNavigation.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
"use client";

import { Sheet, SheetTrigger, SheetContent } from "@/components/ui/sheet";
import {
Sheet,
SheetTrigger,
SheetContent,
SheetClose,
} from "@/components/ui/sheet";
import { Accordion } from "@/components/ui/accordion";

import { Button } from "@/components/ui/button";
Expand Down Expand Up @@ -137,7 +142,9 @@ const MobileNavigation = ({
</Accordion>
<div className="mt-auto">
<a href="/download">
<Button className="p-5 w-full mt-4">{downloadSRText}</Button>
<SheetClose asChild>
<Button className="p-5 w-full mt-4">{downloadSRText}</Button>
</SheetClose>
</a>
</div>
</SheetContent>
Expand Down
15 changes: 9 additions & 6 deletions app/[locale]/components/header/nav/mobile/NavItem.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { SheetClose } from "@/components/ui/sheet";
import Link from "next/link";

export interface NavItemProps {
Expand All @@ -7,12 +8,14 @@ export interface NavItemProps {

const NavItem = ({ title, href }: NavItemProps) => {
return (
<Link
className="flex w-full items-center py-4 focus:text-primary border-b text-sm hover:underline"
href={href}
>
{title}
</Link>
<SheetClose asChild>
<Link
className="flex w-full items-center py-4 focus:text-primary border-b text-sm hover:underline"
href={href}
>
{title}
</Link>
</SheetClose>
);
};

Expand Down
15 changes: 9 additions & 6 deletions app/[locale]/components/header/nav/mobile/NavListItem.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { SheetClose } from "@/components/ui/sheet";
import Link from "next/link";

export interface NavListItemProps {
Expand All @@ -7,12 +8,14 @@ export interface NavListItemProps {

const NavListItem = ({ title, href }: NavListItemProps) => {
return (
<Link
className="flex w-full items-center py-2 focus:text-primary hover:underline"
href={href}
>
{title}
</Link>
<SheetClose asChild>
<Link
className="flex w-full items-center py-2 focus:text-primary hover:underline"
href={href}
>
{title}
</Link>
</SheetClose>
);
};

Expand Down

0 comments on commit 2892e4f

Please sign in to comment.