Created
March 30, 2020 15:37
-
-
Save Porter97/985ea975f3d958276b2b59094092ce6e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { Link } from 'react-router-dom' | |
const LoggedOutView = props => { | |
if (!props.currentUser) { | |
return ( | |
<ul className="nav navbar-nav pull-xs-right"> | |
<li className="nav-item"> | |
<Link to="/" className="nav-link"> | |
Home | |
</Link> | |
</li> | |
<li className="nav-item"> | |
<Link to="login" className="nav-link"> | |
Sign in | |
</Link> | |
</li> | |
<li className="nav-item"> | |
<Link to="register" className="nav-link"> | |
Sign up | |
</Link> | |
</li> | |
</ul> | |
); | |
} | |
return null; | |
}; | |
class Header extends React.Component { | |
render() { | |
return ( | |
<nav className="navbar navbar-light"> | |
<div className="container"> | |
<Link to="/" className="navbar-brand"> | |
{this.props.appName} | |
</Link> | |
<LoggedOutView currentUser={this.props.currentUser}/> | |
</div> | |
</nav> | |
) | |
} | |
} | |
export default Header |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment