-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathNavbar.js
49 lines (41 loc) · 1.52 KB
/
Navbar.js
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
// npm install react-router-dom && bootstrap
import React, { Component } from "react";
import { NavLink, Link } from "react-router-dom";
class Navbar extends Component {
state = {
show: false
}
showMenu = () => {
this.setState({
show: !this.state.show
});
}
render() {
const on = `collapse navbar-collapse ${this.state.show ? 'show' : " "}`
return (
<nav className="navbar navbar-expand-lg navbar-light top-fixed">
<Link className="navbar-brand" to="/">
<div className="logoholder">
<div className="logo">
Logo
</div>
</div>
</Link>
<button onClick={this.showMenu} className="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span className="navbar-toggler-icon"></span>
</button>
<div className={on} id="navbarSupportedContent">
<ul className="navbar-nav ml-auto mr-5">
<li className="nav-item">
<NavLink to="/"className="nav-link">
Home
</NavLink>
</li>
</ul>
</div>
</nav>
);
}
}
export default Navbar;