import React from 'react'
import NavMenu from 'redux/containers/NavMenuContainer'
import { desktopNavMenuWidth, tabletBreakpoint } from 'constants/design'
import '../../styles/core.scss'

class CoreLayout extends React.Component {

  constructor () {
    super()
    this.handleResize = this.handleResize.bind(this)
    this.state = {width: window.innerWidth}
  }

  static propTypes = {
    children: React.PropTypes.element.isRequired
  }

  componentDidMount () {
    window.addEventListener('resize', this.handleResize)
  }

  componentWillUnmount () {
    window.removeEventListener('resize', this.handleResize)
  }

  handleResize () {
    this.setState({width: window.innerWidth})
  }

  navMenuDisplay () {
    return window.location.href.includes('/login') ? 'none' : 'block'
  }

  mainContainerPadding () {
    return window.location.href.includes('/login') || this.state.width <= tabletBreakpoint
      ? '0px' : `${desktopNavMenuWidth}%`
  }

  render () {
    return (
      <div>
        <div style={{'display': this.navMenuDisplay()}} >
          <NavMenu />
        </div>
        <div style={{'paddingLeft': this.mainContainerPadding()}}>
          {this.props.children}
        </div>
      </div>
    )
  }

}

export default CoreLayout

@@ -688,30 +688,27 @@
 %0A  %7D%0A%0A  
-navMenuDisplay
+hasLoggedIn
  () %7B%0A  
@@ -752,33 +752,143 @@
 s('/
-login') ? 'none' : 'block
+dashboard') %7C%7C window.location.href.includes('/application')%0A  %7D%0A%0A  navMenuDisplay () %7B%0A    return this.hasLoggedIn() ? 'block' : 'none
 '%0A  
@@ -933,46 +933,26 @@
 urn 
-window.location.href.includes('/login'
+!this.hasLoggedIn(
 ) %7C%7C
@@ -988,22 +988,16 @@
 eakpoint
-%0A     
  ? '0px'

Fix nav menu appear (#30)