@@ -5,6 +5,9 @@ import { NavLink } from "react-router-dom";
55// redux
66// import { connect } from "react-redux";
77
8+ // event arrays to show on sidebar
9+ import { upcomingEvents , previousEvents } from "./events" ;
10+
811// @material -ui/core
912import Divider from "@material-ui/core/Divider" ;
1013import ExpansionPanel from "@material-ui/core/ExpansionPanel" ;
@@ -17,10 +20,7 @@ import ListItemText from "@material-ui/core/ListItemText";
1720import Typography from "@material-ui/core/Typography" ;
1821
1922// @material -ui/icons
20- import AcUnitIcon from "@material-ui/icons/AcUnit" ;
21- import BeachAccessIcon from "@material-ui/icons/BeachAccess" ;
2223import WelcomeIcon from "@material-ui/icons/Dashboard" ;
23- import WhatshotIcon from "@material-ui/icons/Whatshot" ;
2424
2525// styles
2626import { makeStyles } from "@material-ui/core/styles" ;
@@ -29,26 +29,6 @@ import styles from "./styles";
2929const BasicItems = ( ) => {
3030 const classes = makeStyles ( styles ) ( ) ;
3131
32- const upcomingEvents = [
33- {
34- Icon : WhatshotIcon ,
35- label : "HEAT 2020" ,
36- path : "/heat-2020" ,
37- } ,
38- ] ;
39- const previousEvents = [
40- {
41- Icon : AcUnitIcon ,
42- label : "ERUPT 2020" ,
43- path : "/erupt-2020" ,
44- } ,
45- {
46- Icon : BeachAccessIcon ,
47- label : "SWIFT 2020" ,
48- path : "/swift-2020" ,
49- } ,
50- ] ;
51-
5232 return (
5333 < >
5434 < Divider className = { classes . dividerGray } />
@@ -66,47 +46,64 @@ const BasicItems = () => {
6646 < ListItemText primary = { "Welcome" } />
6747 </ ListItem >
6848
69- < Divider className = { classes . dividerGray } />
70-
71- { /* Upcoming Events */ }
72- < ExpansionPanel
73- expanded
74- elevation = { 0 }
75- classes = { { expanded : classes . expansionPanel } }
76- >
77- < ExpansionPanelSummary >
78- < Typography
79- style = { { textDecoration : "none" , color : "inherit" } }
49+ { upcomingEvents ?. length ? (
50+ < >
51+ < Divider className = { classes . dividerGray } />
52+ { /* Upcoming Events */ }
53+ < ExpansionPanel
54+ expanded
55+ elevation = { 0 }
56+ classes = { { expanded : classes . expansionPanel } }
8057 >
81- { "Upcoming Events" }
82- </ Typography >
83- </ ExpansionPanelSummary >
84- < ExpansionPanelDetails >
85- < List dense disablePadding >
86- { upcomingEvents . map ( ( { Icon, label, path } , index ) => (
87- < React . Fragment key = { path } >
88- { index ? null : (
89- < Divider className = { classes . dividerGray } />
58+ < ExpansionPanelSummary >
59+ < Typography
60+ style = { {
61+ textDecoration : "none" ,
62+ color : "inherit" ,
63+ } }
64+ >
65+ { "Upcoming Events" }
66+ </ Typography >
67+ </ ExpansionPanelSummary >
68+ < ExpansionPanelDetails >
69+ < List dense disablePadding >
70+ { upcomingEvents . map (
71+ ( { Icon, label, path } , index ) => (
72+ < React . Fragment key = { path } >
73+ { index ? null : (
74+ < Divider
75+ className = {
76+ classes . dividerGray
77+ }
78+ />
79+ ) }
80+ < ListItem
81+ button
82+ activeClassName = { classes . active }
83+ component = { NavLink }
84+ to = { path }
85+ >
86+ < ListItemIcon
87+ classes = { {
88+ root :
89+ classes . menuItemIcon ,
90+ } }
91+ >
92+ < Icon />
93+ </ ListItemIcon >
94+ < ListItemText primary = { label } />
95+ </ ListItem >
96+ < Divider
97+ className = { classes . dividerGray }
98+ />
99+ </ React . Fragment >
100+ )
90101 ) }
91- < ListItem
92- button
93- activeClassName = { classes . active }
94- component = { NavLink }
95- to = { path }
96- >
97- < ListItemIcon
98- classes = { { root : classes . menuItemIcon } }
99- >
100- < Icon />
101- </ ListItemIcon >
102- < ListItemText primary = { label } />
103- </ ListItem >
104- < Divider className = { classes . dividerGray } />
105- </ React . Fragment >
106- ) ) }
107- </ List >
108- </ ExpansionPanelDetails >
109- </ ExpansionPanel >
102+ </ List >
103+ </ ExpansionPanelDetails >
104+ </ ExpansionPanel >
105+ </ >
106+ ) : null }
110107
111108 < Divider className = { classes . dividerGray } />
112109
0 commit comments