61 lines
1.8 KiB
JavaScript
Raw Normal View History

2016-08-18 11:41:13 +02:00
/**
*
* App.react.js
*
* This component is the skeleton around the actual pages, and should only
* contain code that should be seen on all pages. (e.g. navigation bar)
2016-08-18 11:47:26 +02:00
*
* NOTE: while this component should technically be a stateless functional
* component (SFC), hot reloading does not currently support SFCs. If hot
* reloading is not a neccessity for you then you can refactor it and remove
* the linting exception.
2016-08-18 11:41:13 +02:00
*/
import React from 'react';
import { connect } from 'react-redux';
2016-09-30 18:25:04 +02:00
import { createStructuredSelector } from 'reselect';
import { selectPlugins } from './selectors';
2016-09-30 18:25:04 +02:00
import { hideNotification } from 'containers/NotificationProvider/actions';
import { selectNotifications } from 'containers/NotificationProvider/selectors';
import Notifications from 'components/Notifications';
2016-08-24 15:09:42 +02:00
import '../../styles/main.scss';
import styles from './styles.scss';
2016-08-18 11:41:13 +02:00
export class App extends React.Component { // eslint-disable-line react/prefer-stateless-function
2016-08-18 11:41:13 +02:00
2016-08-18 11:47:26 +02:00
static propTypes = {
children: React.PropTypes.node,
};
2016-08-18 11:41:13 +02:00
2016-08-18 11:47:26 +02:00
render() {
return (
2016-09-30 18:25:04 +02:00
<div>
<Notifications onHideNotification={this.props.onHideNotification} notifications={this.props.notifications}></Notifications>
<div className={styles.container}>
<div className={styles.baseline}></div>
{React.Children.toArray(this.props.children)}
</div>
2016-08-18 11:47:26 +02:00
</div>
);
}
}
App.propTypes = {
plugins: React.PropTypes.object,
2016-09-30 18:25:04 +02:00
notifications: React.PropTypes.object,
};
2016-09-30 18:25:04 +02:00
const mapStateToProps = createStructuredSelector({
plugins: selectPlugins(),
notifications: selectNotifications(),
});
function mapDispatchToProps(dispatch) {
return {
2016-09-30 18:25:04 +02:00
onHideNotification: (id) => {dispatch(hideNotification(id))},
dispatch,
};
}
export default connect(mapStateToProps, mapDispatchToProps)(App);