Added 'active' on Add server link

This commit is contained in:
Alejandro Celaya 2018-08-14 20:51:38 +02:00
parent 72f96a6d1d
commit a00f59bab3

View file

@ -22,6 +22,9 @@ export class MainHeader extends React.Component {
} }
render() { render() {
const { location } = this.props;
const createServerPath = '/server/create';
return ( return (
<Navbar color="primary" dark fixed="top" className="main-header" expand="md"> <Navbar color="primary" dark fixed="top" className="main-header" expand="md">
<NavbarBrand tag={Link} to="/"> <NavbarBrand tag={Link} to="/">
@ -31,7 +34,11 @@ export class MainHeader extends React.Component {
<Collapse navbar isOpen={this.state.isOpen}> <Collapse navbar isOpen={this.state.isOpen}>
<Nav navbar className="ml-auto"> <Nav navbar className="ml-auto">
<NavItem> <NavItem>
<NavLink tag={Link} to="/server/create"> <NavLink
tag={Link}
to={createServerPath}
active={location.pathname === createServerPath}
>
<FontAwesomeIcon icon={plusIcon}/>&nbsp; Add server <FontAwesomeIcon icon={plusIcon}/>&nbsp; Add server
</NavLink> </NavLink>
</NavItem> </NavItem>