@@ -19,36 +19,38 @@ import SortIcon from '@mui/icons-material/Sort';
19
19
import StarBorderIcon from '@mui/icons-material/StarBorder' ;
20
20
import PersonIcon from '@mui/icons-material/Person' ;
21
21
import greenLogo from '../public/icons/png/512x512.png' ;
22
- import { setStyle } from '../redux/reducers/slice/styleSlice'
23
- import { useSelector , useDispatch } from 'react-redux' ;
22
+ import { setStyle } from '../redux/reducers/slice/styleSlice' ;
23
+ import { useSelector , useDispatch } from 'react-redux' ;
24
24
25
25
// NavBar text and button styling
26
- const useStyles = makeStyles ( ( theme : Theme ) => createStyles ( {
27
- root : {
28
- flexGrow : 1 ,
29
- width : '100%' ,
30
- } ,
31
- menuButton : {
32
- marginRight : theme . spacing ( 2 ) ,
33
- color : 'white' ,
34
- } ,
35
- title : {
36
- flexGrow : 1 ,
37
- color : 'white' ,
38
- } ,
39
- manageProject : {
40
- display : 'flex' ,
41
- justifyContent : 'center' ,
42
- } ,
43
- } ) ) ;
26
+ const useStyles = makeStyles ( ( theme : Theme ) =>
27
+ createStyles ( {
28
+ root : {
29
+ flexGrow : 1 ,
30
+ width : '100%'
31
+ } ,
32
+ menuButton : {
33
+ marginRight : theme . spacing ( 2 ) ,
34
+ color : 'white'
35
+ } ,
36
+ title : {
37
+ flexGrow : 1 ,
38
+ color : 'white'
39
+ } ,
40
+ manageProject : {
41
+ display : 'flex' ,
42
+ justifyContent : 'center'
43
+ }
44
+ } )
45
+ ) ;
44
46
// sorting options
45
47
const sortMethods = [ 'RATING' , 'DATE' , 'USER' ] ;
46
48
// Drop down menu button for SORT PROJECTS
47
49
const StyledMenu = withStyles ( {
48
50
paper : {
49
- border : '1px solid #d3d4d5' ,
51
+ border : '1px solid #d3d4d5'
50
52
}
51
- } ) ( props => (
53
+ } ) ( ( props ) => (
52
54
< Menu
53
55
elevation = { 0 }
54
56
// getContentAnchorEl={null}
@@ -63,7 +65,7 @@ const StyledMenu = withStyles({
63
65
{ ...props }
64
66
/>
65
67
) ) ;
66
- const StyledMenuItem = withStyles ( theme => ( {
68
+ const StyledMenuItem = withStyles ( ( theme ) => ( {
67
69
root : {
68
70
'&:focus' : {
69
71
'& .MuiListItemIcon-root, & .MuiListItemText-primary' : {
@@ -76,95 +78,123 @@ const StyledMenuItem = withStyles(theme => ({
76
78
export default function NavBar ( props ) {
77
79
// TO DO: import setStyle
78
80
const classes = useStyles ( ) ;
79
- const style = useSelector ( store => store . styleSlice ) ;
81
+ const style = useSelector ( ( store ) => store . styleSlice ) ;
80
82
const dispatch = useDispatch ( ) ;
81
83
const toggling = ( ) => setIsOpen ( ! isOpen ) ;
82
84
// toggle to open and close dropdown sorting menu
83
85
const [ isOpen , setIsOpen ] = useState ( false ) ;
84
86
// State for sort projects button
85
87
const [ anchorEl , setAnchorEl ] = React . useState ( null ) ;
86
- const handleClick = event => {
88
+ const handleClick = ( event ) => {
87
89
setAnchorEl ( event . currentTarget ) ;
88
90
} ;
89
91
const handleClose = ( ) => {
90
92
setAnchorEl ( null ) ;
91
93
} ;
92
94
return (
93
95
< div className = { classes . root } style = { style } >
94
- < AppBar position = ' static' >
96
+ < AppBar position = " static" >
95
97
< Toolbar >
96
- < Link to = "/" style = { { display : 'inline-flex' , justifyContent : 'center' , textDecoration : 'none' } } >
98
+ < Link
99
+ to = "/"
100
+ style = { {
101
+ display : 'inline-flex' ,
102
+ justifyContent : 'center' ,
103
+ textDecoration : 'none'
104
+ } }
105
+ >
97
106
< Avatar src = { greenLogo } > </ Avatar >
98
- < Typography variant = "h6" style = { { marginTop : '0.3rem' , marginLeft : '0.5rem' , color : 'silver' } } className = { classes . title } >
107
+ < Typography
108
+ variant = "h6"
109
+ style = { {
110
+ marginTop : '0.3rem' ,
111
+ marginLeft : '0.5rem' ,
112
+ color : 'silver'
113
+ } }
114
+ className = { classes . title }
115
+ >
99
116
ReacType
100
117
</ Typography >
101
- </ Link >
102
- < div style = { { marginLeft : '0.5rem' , textDecoration : 'none' } } >
118
+ </ Link >
119
+ < div style = { { marginLeft : '0.5rem' , textDecoration : 'none' } } >
103
120
< Button
104
- variant = 'contained'
105
- color = 'primary'
106
- onClick = { handleClick }
107
- className = 'navbarButton'
108
- id = 'navbarButton'
109
- endIcon = { < SortIcon /> }
110
- >
111
- SORT PROJECT
112
- </ Button >
113
- < StyledMenu // Dropdown menu connected to Manage Project Button
114
- id = 'customized-menus'
115
- anchorEl = { anchorEl }
116
- keepMounted
117
- open = { Boolean ( anchorEl ) }
118
- onClose = { handleClose }
119
- >
120
- { sortMethods . map ( ( option , index ) => (
121
- < StyledMenuItem onClick = { ( ) => {
122
- props . optionClicked ( option ) ;
123
- toggling ( ) ;
124
- handleClose ( ) ;
125
- } }
126
- variant = 'contained'
127
- color = 'primary'
128
- style = { { minWidth : '137.69px' } }
129
- className = { classes . manageProject }
130
- key = { index }
131
- >
132
- < Button
133
- color = 'primary'
134
- endIcon = { ( option === 'RATING' ) ? < StarBorderIcon /> : ( option === 'DATE' ) ? < EventNoteIcon /> : ( option === 'USER' ) ? < PersonIcon /> : '' }
135
- >
136
- { option }
137
- </ Button >
138
- </ StyledMenuItem >
139
- ) ) }
140
- </ StyledMenu >
141
- </ div >
142
- < Button
143
- className = 'navbarButton'
144
- id = 'navbarDashButton'
145
- color = 'primary'
146
- variant = 'contained'
147
- style = { { minWidth : '113.97px' } }
148
- endIcon = { props . isThemeLight ? < Brightness3Icon /> : < Brightness5Icon /> }
121
+ variant = "contained"
122
+ color = "primary"
123
+ onClick = { handleClick }
124
+ className = "navbarButton"
125
+ id = "navbarButton"
126
+ endIcon = { < SortIcon /> }
127
+ >
128
+ SORT PROJECT
129
+ </ Button >
130
+ < StyledMenu // Dropdown menu connected to Manage Project Button
131
+ id = "customized-menus"
132
+ anchorEl = { anchorEl }
133
+ keepMounted
134
+ open = { Boolean ( anchorEl ) }
135
+ onClose = { handleClose }
136
+ >
137
+ { sortMethods . map ( ( option , index ) => (
138
+ < StyledMenuItem
139
+ onClick = { ( ) => {
140
+ props . optionClicked ( option ) ;
141
+ toggling ( ) ;
142
+ handleClose ( ) ;
143
+ } }
144
+ variant = "contained"
145
+ color = "primary"
146
+ style = { { minWidth : '137.69px' } }
147
+ className = { classes . manageProject }
148
+ key = { index }
149
+ >
150
+ < Button
151
+ color = "primary"
152
+ endIcon = {
153
+ option === 'RATING' ? (
154
+ < StarBorderIcon />
155
+ ) : option === 'DATE' ? (
156
+ < EventNoteIcon />
157
+ ) : option === 'USER' ? (
158
+ < PersonIcon />
159
+ ) : (
160
+ ''
161
+ )
162
+ }
163
+ >
164
+ { option }
165
+ </ Button >
166
+ </ StyledMenuItem >
167
+ ) ) }
168
+ </ StyledMenu >
169
+ </ div >
170
+ < Button
171
+ className = "navbarButton"
172
+ id = "navbarDashButton"
173
+ color = "primary"
174
+ variant = "contained"
175
+ style = { { minWidth : '113.97px' } }
176
+ endIcon = {
177
+ props . isThemeLight ? < Brightness3Icon /> : < Brightness5Icon />
178
+ }
149
179
onClick = { ( ) => {
150
180
! style . backgroundColor
151
181
? dispatch ( setStyle ( { backgroundColor : '#21262D' } ) ) //dark mode color
152
- : dispatch ( setStyle ( null ) )
182
+ : dispatch ( setStyle ( null ) ) ;
153
183
props . isThemeLight ? props . setTheme ( false ) : props . setTheme ( true ) ;
154
184
} }
155
185
>
156
186
{ props . isThemeLight ? 'Dark Mode' : 'Light Mode' }
157
- </ Button >
187
+ </ Button >
158
188
< div >
159
- < Link to = '/' style = { { textDecoration : 'none' } } >
189
+ < Link to = "/" style = { { textDecoration : 'none' } } >
160
190
< Button
161
- variant = ' contained'
162
- color = ' primary'
163
- style = { { minWidth : '137.69px' } }
191
+ variant = " contained"
192
+ color = " primary"
193
+ style = { { minWidth : '137.69px' } }
164
194
className = "navbarButton"
165
195
id = "ratingButton"
166
- endIcon = { < HomeIcon /> }
167
- >
196
+ endIcon = { < HomeIcon /> }
197
+ >
168
198
HOME
169
199
</ Button >
170
200
</ Link >
0 commit comments