@@ -40,17 +40,25 @@ const StyledListItem = styled<
40
40
FC < ListItemProps & { isSelected : boolean ; to : string } >
41
41
> ( ListItem , {
42
42
shouldForwardProp : prop => prop !== 'isSelected' ,
43
- } ) ( ( { theme, isSelected } ) => ( {
44
- ...getListItemCommonStyles ( ) ,
45
- backgroundColor : isSelected
46
- ? theme . mixins . drawer . selectedBackgroundColor
47
- : 'transparent' ,
48
- boxShadow : isSelected ? theme . shadows [ 3 ] : 'none' ,
49
- marginTop : 5 ,
50
- '&:hover' : {
51
- boxShadow : theme . shadows [ 8 ] ,
52
- } ,
53
- } ) ) ;
43
+ } ) ( ( { theme, isSelected } ) =>
44
+ isSelected
45
+ ? {
46
+ ...getListItemCommonStyles ( ) ,
47
+ backgroundColor : theme . mixins . drawer . selectedBackgroundColor ,
48
+ boxShadow : theme . shadows [ 3 ] ,
49
+ fontWeight : 'bold' ,
50
+ marginTop : 5 ,
51
+ }
52
+ : {
53
+ ...getListItemCommonStyles ( ) ,
54
+ backgroundColor : 'transparent' ,
55
+ marginTop : 5 ,
56
+ '&:hover' : {
57
+ boxShadow : theme . shadows [ 3 ] ,
58
+ backgroundColor : theme . palette . background . toolbar ,
59
+ } ,
60
+ }
61
+ ) ;
54
62
55
63
export interface AppNavLinkProps {
56
64
badgeProps ?: BadgeProps ;
@@ -78,6 +86,7 @@ export const AppNavLink: FC<AppNavLinkProps> = props => {
78
86
79
87
const selected = useSelectedNavMenuItem ( to , ! ! end , drawer . isOpen ) ;
80
88
const isSelectedParentItem = inactive && ! ! useMatch ( { path : `${ to } /*` } ) ;
89
+ const showMenuSectionIcon = inactive && drawer . isOpen ;
81
90
const handleClick = ( ) => {
82
91
// reset the clicked nav path when navigating
83
92
// otherwise the child menu remains open
@@ -129,9 +138,22 @@ export const AppNavLink: FC<AppNavLinkProps> = props => {
129
138
component = { CustomLink }
130
139
>
131
140
< ListItemIcon sx = { { minWidth : 20 } } > { icon } </ ListItemIcon >
141
+ { showMenuSectionIcon && (
142
+ < ChevronDownIcon
143
+ className = "menu_section_icon"
144
+ sx = { {
145
+ color : 'gray.main' ,
146
+ fontSize : '1rem' ,
147
+ marginLeft : 0.5 ,
148
+ stroke : theme => theme . palette . gray . main ,
149
+ strokeWidth : 1.5 ,
150
+ transform : 'rotate(-90deg)' ,
151
+ } }
152
+ />
153
+ ) }
132
154
< Box className = "navLinkText" >
133
- < Box width = { 10 } />
134
-
155
+ { ! end && < Box width = { 4 } /> }
156
+ { ! showMenuSectionIcon && < Box width = { 4 } /> }
135
157
< Badge
136
158
{ ...badgeProps }
137
159
sx = { {
@@ -149,34 +171,33 @@ export const AppNavLink: FC<AppNavLinkProps> = props => {
149
171
>
150
172
< ListItemText
151
173
primary = { text }
152
- sx = {
153
- isSelectedParentItem
154
- ? {
155
- '& .MuiTypography-root' : { fontWeight : 'bold' } ,
156
- flexGrow : 0 ,
157
- }
158
- : { flexGrow : 0 }
159
- }
174
+ sx = { {
175
+ '& .MuiTypography-root' : {
176
+ fontWeight :
177
+ selected || isSelectedParentItem ? 'bold' : 'normal' ,
178
+ color : isSelectedParentItem ? 'primary.main' : undefined ,
179
+ } ,
180
+ flexGrow : 0 ,
181
+ } }
160
182
/>
161
183
</ Badge >
162
- { end && (
163
- < ListItemIcon
184
+
185
+ < ListItemIcon
186
+ sx = { {
187
+ minWidth : 20 ,
188
+ display : selected && drawer . isOpen ? 'flex' : 'none' ,
189
+ alignItems : 'center' ,
190
+ } }
191
+ className = "chevron"
192
+ >
193
+ < ChevronDownIcon
164
194
sx = { {
165
- minWidth : 20 ,
166
- display : selected ? 'flex' : 'none ',
167
- alignItems : 'center ' ,
195
+ transform : 'rotate(-90deg)' ,
196
+ fontSize : '1rem ',
197
+ color : 'primary.main ' ,
168
198
} }
169
- className = "chevron"
170
- >
171
- < ChevronDownIcon
172
- sx = { {
173
- transform : 'rotate(-90deg)' ,
174
- fontSize : '1rem' ,
175
- color : 'primary.main' ,
176
- } }
177
- />
178
- </ ListItemIcon >
179
- ) }
199
+ />
200
+ </ ListItemIcon >
180
201
</ Box >
181
202
</ ListItemButton >
182
203
</ StyledListItem >
0 commit comments