UNPKG

inversify-devtools

Version:
52 lines (51 loc) 2.21 kB
"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; var React = require("react"); var menu_1 = require("../../components/menu"); var redux_1 = require("redux"); var react_redux_1 = require("react-redux"); var appActions = require("../../actions/app_actions"); var menuWidthPx = 53; function mapStateToPropsReposPage(state) { return { app: state.get("app") }; } function mapDispatchToPropsReposPage(dispatch) { return { actions: redux_1.bindActionCreators(appActions, dispatch) }; } var AppLayout = (function (_super) { __extends(AppLayout, _super); function AppLayout(props) { _super.call(this, props); } AppLayout.prototype.render = function () { var page = this.props.location.pathname.split("/").join(""); var style = { height: this.props.app.get("windowHeight"), width: (this.props.app.get("windowWidth") - menuWidthPx) }; return (React.createElement("div", null, React.createElement(menu_1.default, {height: this.props.app.get("windowHeight"), width: menuWidthPx, page: page}), React.createElement("div", {className: "main", style: style}, this.props.children))); }; AppLayout.prototype.componentWillMount = function () { this.props.actions.appInitAsync(); }; AppLayout.prototype.componentDidMount = function () { var _this = this; window.addEventListener("resize", function (e) { _this._handleResize(); }); }; AppLayout.prototype.componentWillUnmount = function () { var _this = this; window.removeEventListener("resize", function (e) { _this._handleResize(); }); }; AppLayout.prototype._handleResize = function () { this.props.actions.resize(window.innerWidth, window.innerHeight); }; return AppLayout; }(React.Component)); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = react_redux_1.connect(mapStateToPropsReposPage, mapDispatchToPropsReposPage)(AppLayout);