1
- import { css , type Interpolation , type Theme , useTheme } from "@emotion/react" ;
1
+ import { css , type Interpolation , type Theme } from "@emotion/react" ;
2
2
import MenuItem from "@mui/material/MenuItem" ;
3
+ import { PopoverClose } from "@radix-ui/react-popover" ;
3
4
import { Button } from "components/Button/Button" ;
4
5
import {
5
6
Popover ,
6
7
PopoverContent ,
7
8
PopoverTrigger ,
8
- usePopover ,
9
- } from "components/deprecated/Popover/Popover" ;
9
+ } from "components/Popover/Popover" ;
10
10
import { ChevronDownIcon } from "lucide-react" ;
11
11
import { linkToAuditing } from "modules/navigation" ;
12
12
import type { FC } from "react" ;
@@ -27,8 +27,6 @@ export const DeploymentDropdown: FC<DeploymentDropdownProps> = ({
27
27
canViewConnectionLog,
28
28
canViewHealth,
29
29
} ) => {
30
- const theme = useTheme ( ) ;
31
-
32
30
if (
33
31
! canViewAuditLog &&
34
32
! canViewConnectionLog &&
@@ -41,22 +39,16 @@ export const DeploymentDropdown: FC<DeploymentDropdownProps> = ({
41
39
42
40
return (
43
41
< Popover >
44
- < PopoverTrigger >
42
+ < PopoverTrigger asChild >
45
43
< Button variant = "outline" size = "lg" >
46
44
Admin settings
47
45
< ChevronDownIcon className = "text-content-primary !size-icon-xs" />
48
46
</ Button >
49
47
</ PopoverTrigger >
50
48
51
49
< PopoverContent
52
- horizontal = "right"
53
- css = { {
54
- ".MuiPaper-root" : {
55
- minWidth : "auto" ,
56
- width : 180 ,
57
- boxShadow : theme . shadows [ 6 ] ,
58
- } ,
59
- } }
50
+ align = "end"
51
+ className = "bg-surface-secondary border-surface-quaternary w-[180px] min-w-auto"
60
52
>
61
53
< DeploymentDropdownContent
62
54
canViewDeployment = { canViewDeployment }
@@ -77,61 +69,54 @@ const DeploymentDropdownContent: FC<DeploymentDropdownProps> = ({
77
69
canViewHealth,
78
70
canViewConnectionLog,
79
71
} ) => {
80
- const popover = usePopover ( ) ;
81
-
82
- const onPopoverClose = ( ) => popover . setOpen ( false ) ;
83
-
84
72
return (
85
73
< nav >
86
74
{ canViewDeployment && (
87
- < MenuItem
88
- component = { NavLink }
89
- to = "/deployment"
90
- css = { styles . menuItem }
91
- onClick = { onPopoverClose }
92
- >
93
- Deployment
94
- </ MenuItem >
75
+ < PopoverClose asChild >
76
+ < MenuItem component = { NavLink } to = "/deployment" css = { styles . menuItem } >
77
+ Deployment
78
+ </ MenuItem >
79
+ </ PopoverClose >
95
80
) }
96
81
{ canViewOrganizations && (
97
- < MenuItem
98
- component = { NavLink }
99
- to = "/organizations"
100
- css = { styles . menuItem }
101
- onClick = { onPopoverClose }
102
- >
103
- Organizations
104
- </ MenuItem >
82
+ < PopoverClose asChild >
83
+ < MenuItem
84
+ component = { NavLink }
85
+ to = "/organizations"
86
+ css = { styles . menuItem }
87
+ >
88
+ Organizations
89
+ </ MenuItem >
90
+ </ PopoverClose >
105
91
) }
106
92
{ canViewAuditLog && (
107
- < MenuItem
108
- component = { NavLink }
109
- to = { linkToAuditing }
110
- css = { styles . menuItem }
111
- onClick = { onPopoverClose }
112
- >
113
- Audit Logs
114
- </ MenuItem >
93
+ < PopoverClose asChild >
94
+ < MenuItem
95
+ component = { NavLink }
96
+ to = { linkToAuditing }
97
+ css = { styles . menuItem }
98
+ >
99
+ Audit Logs
100
+ </ MenuItem >
101
+ </ PopoverClose >
115
102
) }
116
103
{ canViewConnectionLog && (
117
- < MenuItem
118
- component = { NavLink }
119
- to = "/connectionlog"
120
- css = { styles . menuItem }
121
- onClick = { onPopoverClose }
122
- >
123
- Connection Logs
124
- </ MenuItem >
104
+ < PopoverClose asChild >
105
+ < MenuItem
106
+ component = { NavLink }
107
+ to = "/connectionlog"
108
+ css = { styles . menuItem }
109
+ >
110
+ Connection Logs
111
+ </ MenuItem >
112
+ </ PopoverClose >
125
113
) }
126
114
{ canViewHealth && (
127
- < MenuItem
128
- component = { NavLink }
129
- to = "/health"
130
- css = { styles . menuItem }
131
- onClick = { onPopoverClose }
132
- >
133
- Healthcheck
134
- </ MenuItem >
115
+ < PopoverClose asChild >
116
+ < MenuItem component = { NavLink } to = "/health" css = { styles . menuItem } >
117
+ Healthcheck
118
+ </ MenuItem >
119
+ </ PopoverClose >
135
120
) }
136
121
</ nav >
137
122
) ;
0 commit comments