Skip to content

Instantly share code, notes, and snippets.

@ryanbelke
Last active October 12, 2018 03:13
Show Gist options
  • Select an option

  • Save ryanbelke/b802afbedb90c056f1d1635877317955 to your computer and use it in GitHub Desktop.

Select an option

Save ryanbelke/b802afbedb90c056f1d1635877317955 to your computer and use it in GitHub Desktop.
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