File tree Expand file tree Collapse file tree 2 files changed +29
-15
lines changed Expand file tree Collapse file tree 2 files changed +29
-15
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ import { cn } from "@/lib/utils";
17
17
import { ThemeProvider } from "@/components/theme-provider" ;
18
18
import Link from "next/link" ;
19
19
import { Button } from "@/components/ui/button" ;
20
- import { Sheet , SheetContent , SheetTrigger } from "@/components/ui/sheet" ;
20
+ import { Sheet , SheetClose , SheetContent , SheetTrigger } from "@/components/ui/sheet" ;
21
21
import NavHeader from "@/components/nav-header" ;
22
22
import Footer from "@/components/footer" ;
23
23
import { Toaster } from "@/components/ui/sonner" ;
@@ -134,9 +134,7 @@ export default async function RootLayout({
134
134
</ SheetTrigger >
135
135
< SheetContent side = "right" >
136
136
< nav className = "py-6 grid gap-2" >
137
- < SheetTrigger asChild >
138
- < NavHeader navLinks = { settings ?. navLinks } sideOnly />
139
- </ SheetTrigger >
137
+ < NavHeader navLinks = { settings ?. navLinks } sideOnly />
140
138
</ nav >
141
139
</ SheetContent >
142
140
</ Sheet >
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import type { Settings } from "@/sanity/types";
4
4
5
5
import { useActivePath } from "@/lib/hooks" ;
6
6
import NavLink from "@/components/nav-link" ;
7
+ import { SheetClose } from "./ui/sheet" ;
7
8
8
9
interface Props {
9
10
navLinks : Exclude < Settings [ "navLinks" ] , undefined > | undefined ;
@@ -18,21 +19,36 @@ export default function NavHeader({
18
19
...restProps
19
20
} : Props ) {
20
21
const checkActivePath = useActivePath ( ) ;
21
-
22
22
return (
23
23
< >
24
24
{ navLinks
25
25
?. filter ( ( l ) => ( sideOnly ? true : l ?. sideOnly !== true ) )
26
- ?. map ( ( l ) => (
27
- < NavLink
28
- { ...restProps }
29
- key = { l . _key }
30
- className = { `${ className || "" } ${ checkActivePath ( l . path ) ? "underline decoration-primary" : "" } ` }
31
- href = { l ?. path || "/" }
32
- >
33
- { l . title }
34
- </ NavLink >
35
- ) ) }
26
+ ?. map ( ( l ) =>
27
+ sideOnly ? (
28
+ < SheetClose asChild key = { l . _key } >
29
+ < NavLink
30
+ { ...restProps }
31
+ className = { `${ className || "" } ${
32
+ checkActivePath ( l . path ) ? "underline decoration-primary" : ""
33
+ } `}
34
+ href = { l ?. path || "/" }
35
+ >
36
+ { l . title }
37
+ </ NavLink >
38
+ </ SheetClose >
39
+ ) : (
40
+ < NavLink
41
+ { ...restProps }
42
+ key = { l . _key }
43
+ className = { `${ className || "" } ${
44
+ checkActivePath ( l . path ) ? "underline decoration-primary" : ""
45
+ } `}
46
+ href = { l ?. path || "/" }
47
+ >
48
+ { l . title }
49
+ </ NavLink >
50
+ ) ,
51
+ ) }
36
52
</ >
37
53
) ;
38
54
}
You can’t perform that action at this time.
0 commit comments