Make navbar show what page you are on
This commit is contained in:
parent
3e2172ac36
commit
6d2cdc44a8
1 changed files with 4 additions and 8 deletions
|
@ -1,17 +1,13 @@
|
|||
import React, { Component } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { NavLink } from 'react-router-dom';
|
||||
|
||||
class NavBar extends Component {
|
||||
render() {
|
||||
let classes= 'item';
|
||||
if (this.props.isActive) {
|
||||
classes += ' active';
|
||||
}
|
||||
return (
|
||||
<div className="ui three item secondary menu">
|
||||
<Link to="/" className='item'>sudoscientist:~#</Link>
|
||||
<Link to="/posts/" className={classes}>Posts</Link>
|
||||
<Link to="/about/" className={classes}>About</Link>
|
||||
<NavLink exact to="/" className='item'>sudoscientist:~#</NavLink>
|
||||
<NavLink to="/posts/" className='item' activeClassName='active'>Posts</NavLink>
|
||||
<NavLink to="/about/" className='item' activeClassName='active'>About</NavLink>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
Reference in a new issue