MyCrypto/common/containers/App/index.jsx

67 lines
1.4 KiB
React
Raw Normal View History

2017-05-24 22:39:58 +00:00
// @flow
2017-05-23 23:06:01 +00:00
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Footer, Header } from 'components';
2017-06-21 23:31:59 +00:00
import Notifications from './Notifications';
2017-07-04 01:25:01 +00:00
import * as actions from 'actions/config';
2017-04-12 05:04:27 +00:00
class App extends Component {
2017-07-04 03:21:19 +00:00
props: {
// FIXME
children: any,
location: any,
router: any,
isMobile: boolean,
2017-07-04 03:21:19 +00:00
languageSelection: string,
nodeSelection: string,
2017-07-04 03:21:19 +00:00
changeLanguage: typeof actions.changeLanguage,
changeNode: typeof actions.changeNode,
handleWindowResize: () => void
};
2017-07-04 03:21:19 +00:00
render() {
let {
children,
// APP
languageSelection,
changeLanguage,
changeNode,
nodeSelection
} = this.props;
2017-06-21 23:31:59 +00:00
2017-07-04 03:21:19 +00:00
let headerProps = {
location,
changeLanguage,
languageSelection,
changeNode,
nodeSelection
2017-05-23 23:06:01 +00:00
};
2017-04-12 05:04:27 +00:00
2017-07-04 03:21:19 +00:00
return (
<div className="page-layout">
<main>
<Header {...headerProps} />
<div className="main-content">
{React.cloneElement(children, { languageSelection })}
</div>
<Footer />
</main>
<Notifications />
</div>
);
}
2017-04-12 05:04:27 +00:00
}
function mapStateToProps(state) {
2017-07-04 03:21:19 +00:00
return {
nodeSelection: state.config.nodeSelection,
nodeToggle: state.config.nodeToggle,
languageSelection: state.config.languageSelection,
languageToggle: state.config.languageToggle
};
2017-04-12 05:04:27 +00:00
}
2017-07-04 01:25:01 +00:00
export default connect(mapStateToProps, actions)(App);