-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdminSideBar.js
More file actions
66 lines (59 loc) · 1.87 KB
/
Copy pathAdminSideBar.js
File metadata and controls
66 lines (59 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import React from "react";
import { Link, withRouter } from "react-router-dom";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import "./AdminSideBar.css";
class AdminTabButton extends React.Component {
render() {
const { activeTab, to, tabLabel, icon, showingMilestones } = this.props;
const active = !showingMilestones && activeTab === to;
return (
<Link
to={to}
className={`u-flex u-flexCenter adminSidebar-iconContainer ${active &&
"adminSidebar-iconContainer--active"}`}
>
<FontAwesomeIcon icon={["fas", icon]} size="2x" />
<span className="adminSidebar-iconLabel">{tabLabel}</span>
</Link>
);
}
}
class AdminSideBar extends React.Component {
render() {
const { year, showingMilestones } = this.props;
return (
<div className={`u-flex u-flexAlignCenter u-darkGrey adminSidebar-container`}>
<AdminTabButton
activeTab={this.props.location.pathname}
tabLabel={`${year} Class`}
icon="calendar-alt"
to="/"
showingMilestones={showingMilestones}
/>
<AdminTabButton
activeTab={this.props.location.pathname}
tabLabel="Students"
icon="user"
to="/students"
showingMilestones={showingMilestones}
/>
<AdminTabButton
activeTab={this.props.location.pathname}
tabLabel="Grade"
icon="highlighter"
to="/grade"
showingMilestones={showingMilestones}
/>
<AdminTabButton
activeTab={this.props.location.pathname}
tabLabel="Settings"
icon="cog"
to="/settings"
showingMilestones={showingMilestones}
/>
</div>
);
}
}
const AdminSideBarWithRouter = withRouter((props) => <AdminSideBar {...props} />);
export default AdminSideBarWithRouter;