import React, {PropTypes} from 'react'
import {connect} from 'react-redux'
import {bindActionCreators} from 'redux'

import SideNav from 'src/side_nav'
import Notifications from 'shared/components/Notifications'

import {publishNotification} from 'shared/actions/notifications'

const {func, node} = PropTypes

const App = React.createClass({
  propTypes: {
    children: node.isRequired,
    notify: func.isRequired,
  },

  handleAddFlashMessage({type, text}) {
    const {notify} = this.props

    notify(type, text)
  },

  render() {
    return (
      <div className="chronograf-root">
        <SideNav />
        <Notifications />
        {this.props.children &&
          React.cloneElement(this.props.children, {
            addFlashMessage: this.handleAddFlashMessage,
          })}
      </div>
    )
  },
})

const mapDispatchToProps = dispatch => ({
  notify: bindActionCreators(publishNotification, dispatch),
})

export default connect(null, mapDispatchToProps)(App)

import React, {PropTypes} from 'react'
import {connect} from 'react-redux'
import {bindActionCreators} from 'redux'

import SideNav from 'src/side_nav'
import Notifications from 'shared/components/Notifications'

import {publishNotification} from 'shared/actions/notifications'

const {func, node} = PropTypes

const App = React.createClass({
  propTypes: {
    children: node.isRequired,
    notify: func.isRequired,
  },

  handleAddFlashMessage({type, text}) {
    const {notify} = this.props

    notify(type, text)
  },

  render() {
    return (
      <div className="chronograf-root">
        <Notifications />
        <SideNav />
        {this.props.children &&
          React.cloneElement(this.props.children, {
            addFlashMessage: this.handleAddFlashMessage,
          })}
      </div>
    )
  },
})

const mapDispatchToProps = dispatch => ({
  notify: bindActionCreators(publishNotification, dispatch),
})

export default connect(null, mapDispatchToProps)(App)

Fix z-index failure caused by Notifications being below SideNav in DOM
Fix z-index failure caused by Notifications being below SideNav in DOM

Signed-off-by: Jared Scheib <06bd14d569e7a29ad7c0a1b3adcce8579ff36322@gmail.com>
