Reorganise/restyle header

This commit is contained in:
Maciej Ziarkowski 2019-09-04 17:04:07 +01:00
parent ceec91670d
commit 6422be118d
2 changed files with 27 additions and 19 deletions

View File

@ -2,10 +2,8 @@
* Main header * Main header
*/ */
.main-header { .main-header {
display: block;
min-height: 79px;
text-decoration: none; text-decoration: none;
border-bottom: 3px solid #222; border-bottom: 2px solid #222;
} }
.main-header .navbar { .main-header .navbar {
padding: 0.75em 0.5em 0.75em; padding: 0.75em 0.5em 0.75em;
@ -13,3 +11,18 @@
.main-header .navbar-brand { .main-header .navbar-brand {
margin: 0 1em 0 0; margin: 0 1em 0 0;
} }
.main-header .shorten-username {
text-overflow: '…)';
white-space: nowrap;
overflow: hidden;
display: inline-block;
vertical-align: bottom;
max-width: 70vw;
}
@media (min-width: 768px) {
.main-header .shorten-username {
max-width: 5vw;
}
}

View File

@ -30,19 +30,24 @@ class Header extends React.Component<any, any> { // TODO: add proper types
render() { render() {
return ( return (
<header className="main-header"> <header className="main-header">
<nav className="navbar navbar-light navbar-expand-md"> <nav className="navbar navbar-light navbar-expand-lg">
<span className="navbar-brand"> <span className="navbar-brand align-self-start">
<Logo/> <Logo/>
</span> </span>
<button className="navbar-toggler navbar-toggler-right" type="button" <button className="navbar-toggler navbar-toggler-right" type="button"
onClick={this.handleClick} aria-expanded="false" aria-label="Toggle navigation"> onClick={this.handleClick} aria-expanded={!this.state.collapseMenu} aria-label="Toggle navigation">
<span className="navbar-toggler-icon"></span> <span className="navbar-toggler-icon"></span>
</button> </button>
<div className={this.state.collapseMenu ? 'collapse navbar-collapse' : 'navbar-collapse'}> <div className={this.state.collapseMenu ? 'collapse navbar-collapse' : 'navbar-collapse'}>
<ul className="navbar-nav ml-auto"> <ul className="navbar-nav ml-auto">
<li className="nav-item">
<NavLink to="/view/categories.html" className="nav-link">
View/Edit Maps
</NavLink>
</li>
<li className="nav-item"> <li className="nav-item">
<a className="nav-link" href="https://pages.colouring.london"> <a className="nav-link" href="https://pages.colouring.london">
Hello About
</a> </a>
</li> </li>
<li className="nav-item"> <li className="nav-item">
@ -50,23 +55,13 @@ class Header extends React.Component<any, any> { // TODO: add proper types
Data Categories Data Categories
</a> </a>
</li> </li>
<li className="nav-item">
<NavLink to="/view/categories.html" className="nav-link">
View/Edit Maps
</NavLink>
</li>
<li className="nav-item">
<a className="nav-link" href="https://pages.colouring.london/about">
More about
</a>
</li>
<li className="nav-item"> <li className="nav-item">
<a className="nav-link" href="https://pages.colouring.london/whoisinvolved"> <a className="nav-link" href="https://pages.colouring.london/whoisinvolved">
Who&rsquo;s Involved? Who&rsquo;s Involved?
</a> </a>
</li> </li>
<li className="nav-item"> <li className="nav-item">
<a className="nav-link" href="https://www.pages.colouring.london/data-ethics"> <a className="nav-link" href="https://pages.colouring.london/data-ethics">
Data Ethics Data Ethics
</a> </a>
</li> </li>
@ -80,7 +75,7 @@ class Header extends React.Component<any, any> { // TODO: add proper types
( (
<li className="nav-item"> <li className="nav-item">
<NavLink to="/my-account.html" className="nav-link"> <NavLink to="/my-account.html" className="nav-link">
My account (Logged in as {this.props.user.username}) Account <span className="shorten-username">({this.props.user.username})</span>
</NavLink> </NavLink>
</li> </li>
): ):