|
@@ -2,13 +2,16 @@ import React, { Component } from 'react';
|
|
import { Link } from "react-router-dom";
|
|
import { Link } from "react-router-dom";
|
|
|
|
|
|
import * as routes from './../../../constants/routes';
|
|
import * as routes from './../../../constants/routes';
|
|
-import { UserContext } from './../../../containers/header';
|
|
|
|
import token from './../../../utils/token';
|
|
import token from './../../../utils/token';
|
|
|
|
|
|
export default class header extends Component {
|
|
export default class header extends Component {
|
|
|
|
|
|
state = {
|
|
state = {
|
|
- togglerClosed: true,
|
|
|
|
|
|
+ togglerClosed: true
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ handleClick = () => {
|
|
|
|
+ this.setState({ togglerClosed: true })
|
|
}
|
|
}
|
|
|
|
|
|
handleToggle = event => {
|
|
handleToggle = event => {
|
|
@@ -28,54 +31,53 @@ export default class header extends Component {
|
|
|
|
|
|
return (
|
|
return (
|
|
<header className="header">
|
|
<header className="header">
|
|
- <Link to={routes.LANDING}>
|
|
|
|
|
|
+ <Link onClick={this.handleClick} to={routes.LANDING}>
|
|
<h1 className="header__logo">Test.<span className="header__logo--i-letter">i</span>o</h1>
|
|
<h1 className="header__logo">Test.<span className="header__logo--i-letter">i</span>o</h1>
|
|
</Link>
|
|
</Link>
|
|
<hr className="header__logo--divider" />
|
|
<hr className="header__logo--divider" />
|
|
- {/* <span className="header__toggle-trigger" onClick={this.handleToggle} >
|
|
|
|
|
|
+ <span className="header__toggle-trigger" onClick={this.handleToggle} >
|
|
<span />
|
|
<span />
|
|
- </span> */}
|
|
|
|
- <button style={{ position: "absolute", top: '85px', left: 0 }} onClick={this.handleToggle}>HEADER TOGGLE</button>
|
|
|
|
|
|
+ </span>
|
|
<div className="header__flex-wrapper">
|
|
<div className="header__flex-wrapper">
|
|
<nav className={`header__nav ${toggleStatus}`}>
|
|
<nav className={`header__nav ${toggleStatus}`}>
|
|
<ul className="header__nav nav__list" >
|
|
<ul className="header__nav nav__list" >
|
|
<li>
|
|
<li>
|
|
- <Link className="header__nav nav__list-item" to={routes.HOME}>
|
|
|
|
|
|
+ <Link onClick={this.handleClick} className="header__nav nav__list-item" to={routes.HOME}>
|
|
Home
|
|
Home
|
|
- </Link>
|
|
|
|
|
|
+ </Link>
|
|
</li>
|
|
</li>
|
|
<li>
|
|
<li>
|
|
- <Link className="header__nav nav__list-item" to={routes.PROFILE}>
|
|
|
|
|
|
+ <Link onClick={this.handleClick} className="header__nav nav__list-item" to={routes.PROFILE}>
|
|
Profile
|
|
Profile
|
|
- </Link>
|
|
|
|
|
|
+ </Link>
|
|
</li>
|
|
</li>
|
|
<li>
|
|
<li>
|
|
- <Link className="header__nav nav__list-item" to={routes.TESTS}>
|
|
|
|
|
|
+ <Link onClick={this.handleClick} className="header__nav nav__list-item" to={routes.TESTS}>
|
|
Test
|
|
Test
|
|
- </Link>
|
|
|
|
|
|
+ </Link>
|
|
</li>
|
|
</li>
|
|
<li>
|
|
<li>
|
|
- <Link className="header__nav nav__list-item" to={routes.CATEGORIES}>
|
|
|
|
|
|
+ <Link onClick={this.handleClick} className="header__nav nav__list-item" to={routes.CATEGORIES}>
|
|
Categories
|
|
Categories
|
|
- </Link>
|
|
|
|
|
|
+ </Link>
|
|
</li>
|
|
</li>
|
|
{
|
|
{
|
|
data && data.is_admin && (
|
|
data && data.is_admin && (
|
|
<React.Fragment>
|
|
<React.Fragment>
|
|
<li>
|
|
<li>
|
|
- <Link className="header__nav nav__list-item--admin-only" to={routes.CREATE_TEST}>
|
|
|
|
|
|
+ <Link onClick={this.handleClick} className="header__nav nav__list-item--admin-only" to={routes.CREATE_TEST}>
|
|
Create test
|
|
Create test
|
|
- </Link>
|
|
|
|
|
|
+ </Link>
|
|
</li>
|
|
</li>
|
|
<li>
|
|
<li>
|
|
- <Link className="header__nav nav__list-item--admin-only" to={routes.CREATE_CATEGORY}>
|
|
|
|
|
|
+ <Link onClick={this.handleClick} className="header__nav nav__list-item--admin-only" to={routes.CREATE_CATEGORY}>
|
|
Create category
|
|
Create category
|
|
- </Link>
|
|
|
|
|
|
+ </Link>
|
|
</li>
|
|
</li>
|
|
<li>
|
|
<li>
|
|
- <Link className="header__nav nav__list-item--admin-only" to={routes.DELETE_USER}>
|
|
|
|
|
|
+ <Link onClick={this.handleClick} className="header__nav nav__list-item--admin-only" to={routes.DELETE_USER}>
|
|
Delete data
|
|
Delete data
|
|
- </Link>
|
|
|
|
|
|
+ </Link>
|
|
</li>
|
|
</li>
|
|
</React.Fragment>
|
|
</React.Fragment>
|
|
)
|
|
)
|
|
@@ -88,8 +90,8 @@ export default class header extends Component {
|
|
!data
|
|
!data
|
|
? (
|
|
? (
|
|
<React.Fragment>
|
|
<React.Fragment>
|
|
- <Link className="header__links--sign-in link--btn link--btn25" to={routes.SIGN_IN}>Sign in</Link>
|
|
|
|
- <Link className="header__links--sign-up link--btn link--btn25" to={routes.SIGN_UP}>Sign up</Link>
|
|
|
|
|
|
+ <Link onClick={this.handleClick} className="header__links--sign-in link--btn link--btn25" to={routes.SIGN_IN}>Sign in</Link>
|
|
|
|
+ <Link onClick={this.handleClick} className="header__links--sign-up link--btn link--btn25" to={routes.SIGN_UP}>Sign up</Link>
|
|
</React.Fragment>
|
|
</React.Fragment>
|
|
)
|
|
)
|
|
: (
|
|
: (
|