1
1
import Collapse from '@mui/material/Collapse' ;
2
2
import List from '@mui/material/List' ;
3
3
import ListItem , { ListItemProps } from '@mui/material/ListItem' ;
4
- import { useTheme } from '@mui/system' ;
5
4
import React , { memo } from 'react' ;
6
5
import { generatePath } from 'react-router' ;
7
6
import { useCluster } from '../../lib/k8s' ;
@@ -44,12 +43,8 @@ const SidebarItem = memo((props: SidebarItemProps) => {
44
43
hide,
45
44
...other
46
45
} = props ;
47
- const hasSubtitle = ! ! subtitle ;
48
- const theme = useTheme ( ) ;
49
46
const cluster = useCluster ( ) ;
50
47
51
- // const classes = useItemStyle({ fullWidth, hasSubtitle: !!subtitle });
52
-
53
48
let fullURL = url ;
54
49
if ( fullURL && useClusterURL && cluster ) {
55
50
fullURL = generatePath ( getClusterPrefixedPath ( url ) , { cluster } ) ;
@@ -69,127 +64,13 @@ const SidebarItem = memo((props: SidebarItemProps) => {
69
64
selected = { isSelected }
70
65
pathname = { fullURL || '' }
71
66
primary = { fullWidth ? label : '' }
72
- containerProps = { {
73
- sx : {
74
- color : theme . palette . sidebarLink . color ,
75
- borderRadius : '4px' ,
76
- marginRight : '5px' ,
77
- marginLeft : theme . spacing ( 5 ) ,
78
- marginBottom : '1px' ,
79
-
80
- '& *' : {
81
- fontSize : '.875rem' ,
82
- textTransform : 'none' ,
83
- } ,
84
- '& .MuiListItem-root' : {
85
- paddingTop : '4px' ,
86
- paddingBottom : '4px' ,
87
- } ,
88
- '& .MuiListItem-button:hover' : {
89
- backgroundColor : 'unset' ,
90
- } ,
91
- '&:hover' : {
92
- backgroundColor : theme . palette . sidebarLink . hover . backgroundColor ,
93
-
94
- '& svg' : {
95
- color : theme . palette . sidebarLink . hover . color ,
96
- } ,
97
- } ,
98
- '& a.Mui-focusVisible' : {
99
- backgroundColor : theme . palette . sidebarLink . hover . backgroundColor ,
100
- } ,
101
- '& svg' : {
102
- color : theme . palette . sidebarLink . color ,
103
- } ,
104
- '& .MuiListItemIcon-root' : {
105
- minWidth : 0 ,
106
- alignSelf : fullWidth && hasSubtitle ? 'stretch' : 'auto' ,
107
- paddingTop : fullWidth && hasSubtitle ? theme . spacing ( 1 ) : 0 ,
108
- marginRight : fullWidth ? '8px' : '0' ,
109
- } ,
110
- '& .MuiListItemText-secondary' : {
111
- fontSize : '.85rem' ,
112
- fontStyle : 'italic' ,
113
- whiteSpace : 'nowrap' ,
114
- textOverflow : 'ellipsis' ,
115
- overflowWrap : 'anywhere' ,
116
- overflow : 'hidden' ,
117
- color : theme . palette . sidebarLink . color ,
118
- } ,
119
-
120
- ...( ! hasParent && {
121
- color : theme . palette . sidebarLink . main . color ,
122
- marginLeft : '5px' ,
123
- marginRight : '5px' ,
124
- borderRadius : '4px' ,
125
-
126
- '& .MuiListItem-root' : {
127
- paddingTop : hasSubtitle ? '0' : '7px' ,
128
- paddingBottom : hasSubtitle ? '0' : '7px' ,
129
- paddingLeft : '19px' ,
130
- minHeight : ! fullWidth ? '56px' : 'unset' ,
131
- } ,
132
-
133
- '& *' : {
134
- fontSize : '1rem' ,
135
- } ,
136
-
137
- '&:hover, &:active' : {
138
- color : theme . palette . sidebarLink . main . color ,
139
- '& svg' : {
140
- color : theme . palette . sidebarLink . main . color ,
141
- } ,
142
- } ,
143
- } ) ,
144
-
145
- ...( ! hasParent &&
146
- isSelected && {
147
- '& svg' : {
148
- color : theme . palette . sidebarLink . main . selected . color ,
149
- } ,
150
- '&:hover, &:active' : {
151
- color : theme . palette . sidebarLink . main . selected . color ,
152
- '& svg' : {
153
- color : theme . palette . sidebarLink . main . selected . color ,
154
- } ,
155
- } ,
156
- '&, & *' : {
157
- color : theme . palette . sidebarLink . main . selected . color ,
158
- } ,
159
- backgroundColor : `${ theme . palette . sidebarLink . main . selected . backgroundColor } !important` ,
160
- '& .MuiListItemText-secondary' : {
161
- fontSize : '.85rem' ,
162
- fontStyle : 'italic' ,
163
- whiteSpace : 'nowrap' ,
164
- textOverflow : 'ellipsis' ,
165
- textTransform : 'none' ,
166
- overflowWrap : 'anywhere' ,
167
- overflow : 'hidden' ,
168
- color : theme . palette . sidebarLink . main . selected . color ,
169
- } ,
170
- '& a.Mui-focusVisible' : {
171
- backgroundColor : theme . palette . sidebarLink . selected . backgroundColor ,
172
- } ,
173
- } ) ,
174
-
175
- ...( hasParent &&
176
- isSelected && {
177
- fontWeight : 'bold' ,
178
- '& .Mui-selected' : {
179
- background : theme . palette . sidebarLink . selected . backgroundColor ,
180
- '& *' : {
181
- fontWeight : 'bold' ,
182
- color : theme . palette . sidebarLink . selected . color ,
183
- } ,
184
- } ,
185
- } ) ,
186
- } ,
187
- } }
188
67
icon = { icon }
189
68
name = { label }
190
69
subtitle = { subtitle }
191
70
search = { search }
192
71
iconOnly = { ! fullWidth }
72
+ hasParent = { hasParent }
73
+ fullWidth = { fullWidth }
193
74
{ ...other }
194
75
/>
195
76
{ subList . length > 0 && (
0 commit comments