content: // src/components/Header.js
  import React, { Component } from 'react';
  import { Nav, Navbar, NavItem } from 'react-bootstrap';
  import PropTypes from 'prop-types';
  import history from '../history';
  
  class HeaderPage extends Component {
    createPoll() {
      history.replace('/polladd');
    }
  
    login() {
      this.props.auth.login();
    }
  
    logout() {
      this.props.auth.logout();
    }
  
    render() {
      const { isAuthenticated } = this.props.auth;
  
      return (
        <Navbar fluid>
          <Navbar.Header>
            <Navbar.Brand>
              VotePlex Polls
            </Navbar.Brand>
          </Navbar.Header>
          {
            !isAuthenticated() && (
              <Nav>
                <NavItem onClick={() => this.login()}>
                  Login
              </NavItem>
              </Nav>
            )
          }
          {
            isAuthenticated() && (
              <Nav>
                <NavItem onClick={() => this.logout()}>
                  Logout
              </NavItem>
                <NavItem onClick={() => this.createPoll()}>
                  Create a Poll
              </NavItem>
              </Nav>
            )
          }
        </Navbar>
      );
    }
  }
  
  HeaderPage.propTypes = {
    auth: PropTypes.object.isRequired
  };
  export default HeaderPage;
  