@@ -6,10 +6,11 @@ import { Button } from "@radix-ui/themes";
6
6
import dropDownIcon from "../../assets/dropdown_arrow.svg" ;
7
7
import { useAtomValue } from "jotai" ;
8
8
import { containerElAtom } from "../../atoms" ;
9
- import { PropsWithChildren } from "react" ;
9
+ import { PropsWithChildren , useState } from "react" ;
10
10
11
11
export default function DropDownNavLinks ( { children } : PropsWithChildren ) {
12
12
const containerEl = useAtomValue ( containerElAtom ) ;
13
+ const [ dropdownOpen , setDropdownOpen ] = useState ( false ) ;
13
14
14
15
const location = useLocation ( ) ;
15
16
let route = "Overview" ;
@@ -20,7 +21,7 @@ export default function DropDownNavLinks({ children }: PropsWithChildren) {
20
21
}
21
22
22
23
return (
23
- < DropdownMenu . Root >
24
+ < DropdownMenu . Root open = { dropdownOpen } onOpenChange = { setDropdownOpen } >
24
25
< DropdownMenu . Trigger asChild >
25
26
{ children || (
26
27
< Button className = { styles . button } >
@@ -30,10 +31,18 @@ export default function DropDownNavLinks({ children }: PropsWithChildren) {
30
31
) }
31
32
</ DropdownMenu . Trigger >
32
33
< DropdownMenu . Portal container = { containerEl } >
33
- < DropdownMenu . Content className = { styles . content } sideOffset = { 5 } >
34
+ < DropdownMenu . Content
35
+ className = { styles . content }
36
+ sideOffset = { 5 }
37
+ onClick = { ( ) => setDropdownOpen ( false ) }
38
+ >
34
39
< DropdownMenu . Item className = { styles . item } >
35
40
< NavLink to = "/" label = "Overview" />
41
+ </ DropdownMenu . Item >
42
+ < DropdownMenu . Item className = { styles . item } >
36
43
< NavLink to = "/leaderSchedule" label = "Leader Schedule" />
44
+ </ DropdownMenu . Item >
45
+ < DropdownMenu . Item className = { styles . item } >
37
46
< NavLink to = "/gossip" label = "Gossip" />
38
47
</ DropdownMenu . Item >
39
48
</ DropdownMenu . Content >
0 commit comments