fleet/frontend/layouts/CoreLayout/CoreLayout.jsx
Mike Stone ee3d96eb53 Update eslint (#337)
* Updates eslint packages

* Expected parentheses around arrow function argument having a body with curly braces

* Prop type `object` is forbidden

* Visible, non-interactive elements should not have mouse or keyboard event listeners

* Prop type is defined but not used

* Unexpected use of file extension "jsx"

* Expected 'this' to be used by class method

* HTML entities must be escaped

* Prevent default behavior on more options button click
2016-10-21 19:13:41 -04:00

62 lines
1.6 KiB
JavaScript

import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { StyleRoot } from 'radium';
import componentStyles from './styles';
import configInterface from '../../interfaces/config';
import FlashMessage from '../../components/FlashMessage';
import SiteNavSidePanel from '../../components/side_panels/SiteNavSidePanel';
import notificationInterface from '../../interfaces/notification';
import userInterface from '../../interfaces/user';
export class CoreLayout extends Component {
static propTypes = {
children: PropTypes.node,
config: configInterface,
dispatch: PropTypes.func,
notifications: notificationInterface,
showRightSidePanel: PropTypes.bool,
user: userInterface,
};
render () {
const { children, config, dispatch, notifications, showRightSidePanel, user } = this.props;
const { wrapperStyles } = componentStyles;
if (!user) return false;
const { pathname } = global.window.location;
return (
<StyleRoot>
<SiteNavSidePanel
config={config}
pathname={pathname}
user={user}
/>
<div style={wrapperStyles(showRightSidePanel)}>
<FlashMessage notification={notifications} dispatch={dispatch} />
{children}
</div>
</StyleRoot>
);
}
}
const mapStateToProps = (state) => {
const {
app: { config, showRightSidePanel },
auth: { user },
notifications,
} = state;
return {
config,
notifications,
showRightSidePanel,
user,
};
};
export default connect(mapStateToProps)(CoreLayout);