Sha256: 2ea2f32cd7809964f86ef5de420b18fe0e3f8e59dfd704fde7958514bb4216b6

Contents?: true

Size: 1.15 KB

Versions: 2

Compression:

Stored size: 1.15 KB

Contents

// @flow
import React from "react";
import {Link} from "react-router-dom";

export default class Header extends React.Component {
  props: {
    siteName: string;
  }

  sidebarToggle(e: SyntheticEvent) {
    e.preventDefault();
    this.toggle("sidebar-hidden");
  }

  mobileSidebarToggle(e: SyntheticEvent) {
    e.preventDefault();
    this.toggle("sidebar-mobile-show");
  }

  asideToggle(e: SyntheticEvent) {
    e.preventDefault();
    this.toggle("aside-menu-hidden");
  }

  toggle(name: string) {
    const body = document.body;
    if (body) {
      body.classList.toggle(name);
    }
  }

  render() {
    return (
      <header className="app-header navbar">
        <button className="navbar-toggler mobile-sidebar-toggler hidden-lg-up" onClick={this.mobileSidebarToggle.bind(this)} type="button">&#9776;</button>
        <Link to="/" className="navbar-brand">{this.props.siteName}</Link>
        <ul className="nav navbar-nav hidden-md-down">
          <li className="nav-item">
            <a className="nav-link navbar-toggler sidebar-toggler" onClick={this.sidebarToggle.bind(this)} href="#">&#9776;</a>
          </li>
        </ul>
      </header>
    );
  }
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
admin_core-0.0.2 client/src/components/Header.jsx
admin_core-0.0.1 client/src/components/Header.jsx