-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHeader.js
More file actions
51 lines (45 loc) · 1.17 KB
/
Copy pathHeader.js
File metadata and controls
51 lines (45 loc) · 1.17 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
import React, { Component } from 'react';
import { Link } from 'react-router';
const db = require('../../database/queries/db');
class Header extends Component {
constructor(props) {
super(props);
this.state = { id: null };
}
componentWillMount() {
this.setLink();
}
setLink() {
const index = _.random(0, db.length);
this.setState({ id: index });
}
render() {
return (
<div className="row">
<nav>
<div className="nav-wrapper">
<div className="col s12">
<a href="#" className="brand-logo">UpStar Music</a>
<ul id="nav-mobile" className="right hide-on-med-and-down">
<li>
<Link
to={`/artists/${this.state.id}`}
onClick={this.setLink.bind(this)}
>
Random Artist
</Link>
</li>
<li>
<Link to={'/artists/new'}>
Create Artist
</Link>
</li>
</ul>
</div>
</div>
</nav>
</div>
);
}
};
export default Header;