File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change 1
- import React , { useEffect , useState } from 'react' ;
1
+ import React , { useEffect , useRef , useState } from 'react' ;
2
2
import { Link } from 'react-router-dom' ;
3
3
import Avatar from '@mui/material/Avatar' ;
4
4
import Button from '@mui/material/Button' ;
@@ -26,11 +26,14 @@ const NavBar = () => {
26
26
) ;
27
27
28
28
const dispatch = useDispatch ( ) ;
29
+ const menuButtonRef = useRef ( null ) ;
29
30
30
31
useEffect ( ( ) => {
31
32
setProjectName ( state . name )
32
33
} , [ state . name ] ) //update the ProjectName after state.name changes due to loading projects
33
34
35
+
36
+
34
37
const buttonContainerStyle = {
35
38
display : 'flex' ,
36
39
alignItems : 'center' ,
@@ -129,13 +132,15 @@ const NavBar = () => {
129
132
style = { moreVertButtonStyle }
130
133
variant = "contained"
131
134
color = "primary"
132
- onClick = { ( ) => setDropMenu ( ( prevDropMenu ) => ! prevDropMenu ) }
135
+ onClick = { ( ) => setDropMenu ( ! dropMenu ) }
136
+ ref = { menuButtonRef }
133
137
>
134
138
< MoreVertIcon style = { { color : 'white' } } />
135
139
</ Button >
136
140
< NavBarButtons
137
141
dropMenu = { dropMenu }
138
142
setDropMenu = { setDropMenu }
143
+ menuButtonRef = { menuButtonRef }
139
144
style = { { color : 'white' } }
140
145
/>
141
146
</ div >
Original file line number Diff line number Diff line change @@ -302,8 +302,9 @@ function navbarDropDown(props) {
302
302
const handleClick = ( event ) => {
303
303
if ( event . type === "click" &&
304
304
( dropdownRef . current &&
305
- ! dropdownRef . current . contains ( event . target ) ) || event . type === "message" && event . data === 'iframeClicked'
305
+ ! dropdownRef . current . contains ( event . target ) && ! props . menuButtonRef . current . contains ( event . target ) ) || event . type === "message" && event . data === 'iframeClicked'
306
306
) {
307
+ //menuButtonRef is to ensure that handleClose does not get invoked when the user clicks on the menu dropdown button
307
308
handleClose ( ) ;
308
309
}
309
310
} ;
@@ -388,10 +389,11 @@ function navbarDropDown(props) {
388
389
width = "16"
389
390
height = "16"
390
391
fill = "currentColor"
391
- className = "bi bi-book "
392
+ className = "bi bi-bag-check "
392
393
viewBox = "0 0 16 16"
393
394
>
394
- < path d = "M1 2.828c.885-.37 2.154-.769 3.388-.893 1.33-.134 2.458.063 3.112.752v9.746c-.935-.53-2.12-.603-3.213-.493-1.18.12-2.37.461-3.287.811V2.828zm7.5-.141c.654-.689 1.782-.886 3.112-.752 1.234.124 2.503.523 3.388.893v9.923c-.918-.35-2.107-.692-3.287-.81-1.094-.111-2.278-.039-3.213.492V2.687zM8 1.783C7.015.936 5.587.81 4.287.94c-1.514.153-3.042.672-3.994 1.105A.5.5 0 0 0 0 2.5v11a.5.5 0 0 0 .707.455c.882-.4 2.303-.881 3.68-1.02 1.409-.142 2.59.087 3.223.877a.5.5 0 0 0 .78 0c.633-.79 1.814-1.019 3.222-.877 1.378.139 2.8.62 3.681 1.02A.5.5 0 0 0 16 13.5v-11a.5.5 0 0 0-.293-.455c-.952-.433-2.48-.952-3.994-1.105C10.413.809 8.985.936 8 1.783z" />
395
+ < path fillRule = "evenodd" d = "M10.854 8.146a.5.5 0 0 1 0 .708l-3 3a.5.5 0 0 1-.708 0l-1.5-1.5a.5.5 0 0 1 .708-.708L7.5 10.793l2.646-2.647a.5.5 0 0 1 .708 0z" />
396
+ < path d = "M8 1a2.5 2.5 0 0 1 2.5 2.5V4h-5v-.5A2.5 2.5 0 0 1 8 1zm3.5 3v-.5a3.5 3.5 0 1 0-7 0V4H1v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V4h-3.5zM2 5h12v9a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V5z" />
395
397
</ svg >
396
398
</ button >
397
399
</ Link >
You can’t perform that action at this time.
0 commit comments