Last active
October 12, 2018 03:13
-
-
Save ryanbelke/b802afbedb90c056f1d1635877317955 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 { unsetToken } from "../lib/auth"; | |
| class Layout extends React.Component { | |
| render() { | |
| const { isAuthenticated, children } = this.props; | |
| return ( | |
| <div> | |
| <header> | |
| <Nav className="navbar navbar-dark bg-dark"> | |
| {isAuthenticated ? ( | |
| <> | |
| <NavItem className="ml-auto"> | |
| <span style={{ color: "white", marginRight: 30 }}> | |
| {this.props.loggedUser} | |
| </span> | |
| </NavItem> | |
| <NavItem> | |
| <Link href="/"> | |
| <a className="logout" onClick={unsetToken}> | |
| Logout | |
| </a> | |
| </Link> | |
| </NavItem> | |
| </> | |
| ) : ( | |
| <> | |
| <NavItem className="ml-auto"> | |
| <Link href="/signin"> | |
| <a className="nav-link">Sign In</a> | |
| </Link> | |
| </NavItem> | |
| <NavItem> | |
| <Link href="/signup"> | |
| <a className="nav-link"> Sign Up</a> | |
| </Link> | |
| </NavItem> | |
| </> | |
| )} | |
| </Nav> | |
| </header> | |
| </div> | |
| ); | |
| } | |
| } | |
| export default defaultPage(Layout); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment