Skip to content

Commit 263d064

Browse files
committed
Create navbar
1 parent fe2ffdc commit 263d064

File tree

5 files changed

+46
-13
lines changed

5 files changed

+46
-13
lines changed

views/components/Main.jsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,23 @@ import Announcements from './Announcements/Container';
77
export default class Main extends Component {
88
constructor(props) {
99
super(props);
10-
console.log(props);
1110
this.state = {
1211
windowToRender: 'announcement'
1312
};
13+
14+
this.switchView = this.switchView.bind(this);
15+
}
16+
17+
switchView(view) {
18+
this.setState({ windowToRender: view });
19+
console.log(view);
1420
}
1521

1622
render() {
1723
return (
1824
<div>
1925
<div id="aSide">
20-
<NavBar windowToRender={this.state.windowToRender} />
26+
<NavBar switchView={this.switchView} windowToRender={this.state.windowToRender} />
2127
</div>
2228
<div id="content">
2329
<Announcements />

views/components/NavBar.jsx

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
'use babel';
22

3-
import React, { PropTypes } from 'react';
4-
5-
export default function NavBar(props) {
6-
return (
7-
<div>
8-
This is a nav bar {props.windowToRender}
9-
</div>
10-
);
3+
import React, { Component, PropTypes } from 'react';
4+
import styles from './navbar.css';
5+
6+
export default class NavBar extends Component {
7+
8+
render() {
9+
return (
10+
<div className={styles.navBar}>
11+
<ul>
12+
<li><button className={styles.navButton} onClick={this.props.switchView.bind(null, 'announcement')}><i className="material-icons">announcement</i></button></li>
13+
<li><button className={styles.navButton} onClick={this.props.switchView.bind(null, 'webcast')}><i className="material-icons">video_library</i></button></li>
14+
<li><button className={styles.navButton} onClick={this.props.switchView.bind(null, 'forum')}><i className="material-icons">forum</i></button></li>
15+
</ul>
16+
</div>
17+
);
18+
}
1119
}
1220

1321
NavBar.propTypes = {

views/components/navbar.css

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.navBar {
2+
padding-top: 1.5px;
3+
}
4+
5+
.navBar > ul {
6+
margin: 0;
7+
padding: 0;
8+
} .navBar > ul > li {
9+
margin: 3px 0;
10+
list-style: none;
11+
}
12+
13+
.navButton {
14+
padding: 18px 0;
15+
text-align: center;
16+
background-color: rgba(0,0,0,0.1);
17+
} .navButton > i {
18+
font-size: 1.95em;
19+
}

views/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<head>
55
<meta charset="utf-8" />
66
<title>Notify</title>
7+
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
78
<link href="https://fonts.googleapis.com/css?family=Arimo:400,400i,700,700i|Oxygen:700" rel="stylesheet">
89
<link href="./styles/base.css" rel="stylesheet" >
910
<link href="../dist/styles.css" rel="stylesheet" type="text/css">

views/styles/base.css

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,17 @@ body {
88
background-color: rgb(250, 250, 250);
99
}
1010

11-
button {
11+
button, input[type=button] {
1212
background-color: #4CAF50; /* Green */
1313
width: 100%;
1414
border: none;
1515
color: white;
16-
padding: 15px 32px;
1716
text-align: left;
1817
text-decoration: none;
1918
display: inline-block;
2019
font-size: 16px;
2120
cursor: pointer;
22-
} button:focus {
21+
} button:focus, input[type=button]:focus {
2322
outline: none;
2423
}
2524

0 commit comments

Comments
 (0)