@@ -4,6 +4,8 @@ import * as NavigationMenu from "@radix-ui/react-navigation-menu"
4
4
5
5
import { Button } from "@/components/Buttons"
6
6
7
+ import { isMobile } from "@/lib/utils/isMobile"
8
+
7
9
import { MAIN_NAV_ID , NAV_PY , SECTION_LABELS } from "@/lib/constants"
8
10
9
11
import type { NavSections } from "../types"
@@ -26,6 +28,8 @@ const Menu = ({ sections, ...props }: NavMenuProps) => {
26
28
onClose,
27
29
} = useNavMenu ( sections )
28
30
31
+ const isDesktop = ! isMobile ( )
32
+
29
33
return (
30
34
< Box { ...props } >
31
35
< NavigationMenu . Root
@@ -78,32 +82,37 @@ const Menu = ({ sections, ...props }: NavMenuProps) => {
78
82
</ Text >
79
83
</ Button >
80
84
</ NavigationMenu . Trigger >
81
- < NavigationMenu . Content asChild >
82
- { /**
83
- * This is the CONTAINER for all three menu levels
84
- * This renders inside the NavigationMenu.Viewport component
85
- */ }
86
- < Box
87
- as = { motion . div }
88
- variants = { containerVariants }
89
- initial = { false }
90
- animate = { isOpen ? "open" : "closed" }
91
- position = "absolute"
92
- top = "19"
93
- insetInline = "0"
94
- shadow = "md"
95
- border = "1px"
96
- borderColor = { menuColors . stroke }
97
- bg = { menuColors . lvl [ 1 ] . background }
98
- >
99
- < SubMenu
100
- lvl = { 1 }
101
- items = { items }
102
- activeSection = { activeSection }
103
- onClose = { onClose }
104
- />
105
- </ Box >
106
- </ NavigationMenu . Content >
85
+
86
+ { /* avoid rendering desktop menu on mobile */ }
87
+ { /* Desktop Menu content */ }
88
+ { isDesktop && (
89
+ < NavigationMenu . Content asChild >
90
+ { /**
91
+ * This is the CONTAINER for all three menu levels
92
+ * This renders inside the NavigationMenu.Viewport component
93
+ */ }
94
+ < Box
95
+ as = { motion . div }
96
+ variants = { containerVariants }
97
+ initial = { false }
98
+ animate = { isOpen ? "open" : "closed" }
99
+ position = "absolute"
100
+ top = "19"
101
+ insetInline = "0"
102
+ shadow = "md"
103
+ border = "1px"
104
+ borderColor = { menuColors . stroke }
105
+ bg = { menuColors . lvl [ 1 ] . background }
106
+ >
107
+ < SubMenu
108
+ lvl = { 1 }
109
+ items = { items }
110
+ activeSection = { activeSection }
111
+ onClose = { onClose }
112
+ />
113
+ </ Box >
114
+ </ NavigationMenu . Content >
115
+ ) }
107
116
</ NavigationMenu . Item >
108
117
)
109
118
} ) }
0 commit comments