2018-10-02 16:48:13 -04:00
|
|
|
import React, { Fragment } from 'react';
|
2018-09-09 17:22:44 -04:00
|
|
|
import { NavLink } from 'react-router-dom';
|
|
|
|
|
2019-11-13 14:20:47 -05:00
|
|
|
import './header.css';
|
|
|
|
|
2019-08-14 03:56:00 -04:00
|
|
|
import { Logo } from './components/logo';
|
2019-11-05 15:13:10 -05:00
|
|
|
import { User } from './models/user';
|
2020-02-03 17:35:32 -05:00
|
|
|
import Categories from './building/categories';
|
2019-11-05 15:13:10 -05:00
|
|
|
|
2019-10-28 12:46:22 -04:00
|
|
|
|
|
|
|
interface HeaderProps {
|
2019-11-05 15:13:10 -05:00
|
|
|
user: User;
|
2019-10-28 12:46:22 -04:00
|
|
|
animateLogo: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface HeaderState {
|
|
|
|
collapseMenu: boolean;
|
|
|
|
}
|
|
|
|
|
2018-09-09 17:22:44 -04:00
|
|
|
/**
|
2019-05-23 09:41:20 -04:00
|
|
|
* Render the main header using a responsive design
|
2018-09-09 17:22:44 -04:00
|
|
|
*/
|
2019-11-05 15:13:10 -05:00
|
|
|
class Header extends React.Component<HeaderProps, HeaderState> {
|
2019-05-27 11:39:16 -04:00
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
this.state = {collapseMenu: true};
|
|
|
|
this.handleClick = this.handleClick.bind(this);
|
2019-09-18 09:33:23 -04:00
|
|
|
this.handleNavigate = this.handleNavigate.bind(this);
|
2019-05-27 11:39:16 -04:00
|
|
|
}
|
2019-05-23 09:41:20 -04:00
|
|
|
|
2019-05-27 11:39:16 -04:00
|
|
|
handleClick() {
|
|
|
|
this.setState(state => ({
|
|
|
|
collapseMenu: !state.collapseMenu
|
|
|
|
}));
|
|
|
|
}
|
2019-05-23 09:41:20 -04:00
|
|
|
|
2019-09-18 09:33:23 -04:00
|
|
|
handleNavigate() {
|
|
|
|
this.setState({
|
|
|
|
collapseMenu: true
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-05-27 11:39:16 -04:00
|
|
|
render() {
|
|
|
|
return (
|
2020-02-03 16:24:14 -05:00
|
|
|
<header className="main-header navbar navbar-light">
|
|
|
|
<div className="nav-header">
|
|
|
|
<NavLink to="/">
|
|
|
|
<Logo variant={this.props.animateLogo ? 'animated' : 'default'}/>
|
|
|
|
</NavLink>
|
|
|
|
<button className="navbar-toggler" type="button"
|
2019-09-04 12:04:07 -04:00
|
|
|
onClick={this.handleClick} aria-expanded={!this.state.collapseMenu} aria-label="Toggle navigation">
|
2020-01-27 12:18:13 -05:00
|
|
|
Menu
|
|
|
|
{
|
|
|
|
this.state.collapseMenu ?
|
|
|
|
<span className="navbar-toggler-icon"></span>
|
|
|
|
: <span className="close">×</span>
|
|
|
|
}
|
2019-05-27 11:39:16 -04:00
|
|
|
</button>
|
2020-02-03 16:24:14 -05:00
|
|
|
</div>
|
|
|
|
<nav className={this.state.collapseMenu ? 'collapse navbar-collapse' : 'navbar-collapse'}>
|
2020-04-09 11:52:41 -04:00
|
|
|
<Categories mode='view' />
|
|
|
|
<hr />
|
2020-02-03 16:24:14 -05:00
|
|
|
<ul className="navbar-nav flex-column">
|
|
|
|
<li className="nav-item">
|
|
|
|
<NavLink to="/view/categories" className="nav-link" onClick={this.handleNavigate}>
|
|
|
|
View/Edit Maps
|
|
|
|
</NavLink>
|
|
|
|
</li>
|
|
|
|
<li className="nav-item">
|
|
|
|
<NavLink to="/data-extracts.html" className="nav-link" onClick={this.handleNavigate}>
|
|
|
|
Downloads
|
|
|
|
</NavLink>
|
|
|
|
</li>
|
2020-04-09 11:58:59 -04:00
|
|
|
{/*
|
2020-02-03 16:24:14 -05:00
|
|
|
<li className="nav-item">
|
|
|
|
<NavLink to="/showcase.html" className="nav-link" onClick={this.handleNavigate}>
|
|
|
|
Showcase
|
|
|
|
</NavLink>
|
|
|
|
</li>
|
2020-04-09 11:58:59 -04:00
|
|
|
*/}
|
2020-02-03 16:24:14 -05:00
|
|
|
<li className="nav-item">
|
2020-04-09 11:58:59 -04:00
|
|
|
<NavLink to="/leaderboard.html" className="nav-link" onClick={this.handleNavigate}>
|
|
|
|
Leaderboard
|
2020-02-03 16:24:14 -05:00
|
|
|
</NavLink>
|
|
|
|
</li>
|
|
|
|
<li className="nav-item">
|
|
|
|
<a className="nav-link" href="https://discuss.colouring.london">
|
|
|
|
Discuss
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
{
|
|
|
|
this.props.user?
|
|
|
|
(
|
|
|
|
<li className="nav-item">
|
|
|
|
<NavLink to="/my-account.html" className="nav-link" onClick={this.handleNavigate}>
|
|
|
|
Account <span className="shorten-username">({this.props.user.username})</span>
|
|
|
|
</NavLink>
|
|
|
|
</li>
|
|
|
|
):
|
|
|
|
(
|
|
|
|
<Fragment>
|
|
|
|
<li className="nav-item">
|
|
|
|
<NavLink to="/login.html" className="nav-link" onClick={this.handleNavigate}>
|
|
|
|
Log in
|
|
|
|
</NavLink>
|
|
|
|
</li>
|
|
|
|
<li className="nav-item">
|
|
|
|
<NavLink to="/sign-up.html" className="nav-link" onClick={this.handleNavigate}>
|
|
|
|
Sign up
|
|
|
|
</NavLink>
|
|
|
|
</li>
|
|
|
|
</Fragment>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
</ul>
|
|
|
|
<hr />
|
|
|
|
<ul className="navbar-nav flex-column">
|
|
|
|
<li className="nav-item">
|
|
|
|
<a className="nav-link" href="https://pages.colouring.london">
|
|
|
|
About
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li className="nav-item">
|
|
|
|
<a className="nav-link" href="https://pages.colouring.london/buildingcategories">
|
|
|
|
Data Categories
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li className="nav-item">
|
|
|
|
<a className="nav-link" href="https://pages.colouring.london/whoisinvolved">
|
|
|
|
Who’s Involved?
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
<li className="nav-item">
|
|
|
|
<a className="nav-link" href="https://pages.colouring.london/data-ethics">
|
|
|
|
Data Ethics
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<hr />
|
|
|
|
<ul className="navbar-nav flex-column">
|
|
|
|
<li className="nav-item">
|
|
|
|
<NavLink to="/contact.html" className="nav-link" onClick={this.handleNavigate}>
|
|
|
|
Contact
|
|
|
|
</NavLink>
|
|
|
|
</li>
|
|
|
|
<li className="nav-item">
|
|
|
|
<NavLink to="/privacy-policy.html" className="nav-link" onClick={this.handleNavigate}>
|
|
|
|
Privacy Policy
|
|
|
|
</NavLink>
|
|
|
|
</li>
|
|
|
|
<li className="nav-item">
|
|
|
|
<NavLink to="/contributor-agreement.html" className="nav-link" onClick={this.handleNavigate}>
|
|
|
|
Contributor Agreement
|
|
|
|
</NavLink>
|
|
|
|
</li>
|
|
|
|
<li className="nav-item">
|
|
|
|
<NavLink to="/code-of-conduct.html" className="nav-link" onClick={this.handleNavigate}>
|
|
|
|
Code of Conduct
|
|
|
|
</NavLink>
|
|
|
|
</li>
|
|
|
|
<li className="nav-item">
|
|
|
|
<NavLink to="/data-accuracy.html" className="nav-link" onClick={this.handleNavigate}>
|
|
|
|
Data Accuracy Agreement
|
|
|
|
</NavLink>
|
|
|
|
</li>
|
|
|
|
<li className="nav-item">
|
|
|
|
<NavLink to="/ordnance-survey-uprn.html" className="nav-link" onClick={this.handleNavigate}>
|
|
|
|
Ordnance Survey terms of UPRN usage
|
|
|
|
</NavLink>
|
|
|
|
</li>
|
|
|
|
</ul>
|
2019-05-27 11:39:16 -04:00
|
|
|
</nav>
|
|
|
|
</header>
|
|
|
|
);
|
|
|
|
}
|
2019-05-23 09:41:20 -04:00
|
|
|
}
|
2018-10-02 16:48:13 -04:00
|
|
|
|
2018-09-09 17:22:44 -04:00
|
|
|
export default Header;
|