Created
March 30, 2020 17:16
-
-
Save Porter97/6743727124d9f24b1341e8f6a094efcb 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
#... | |
const LoggedInView = 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="settings" className="nav-link"> | |
Settings | |
</Link> | |
</li> | |
<li className="nav-item"> | |
<Link to={`@${props.currentUser.username}`} | |
className="nav-link"> | |
<img src={props.currentUser.image} alt="none" className="user-pic" /> | |
</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}/> | |
<LoggedInView currentUser={this.props.currentUser} /> | |
</div> | |
</nav> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment