UNPKG

@bigfishtv/cockpit

Version:

59 lines (46 loc) 2.95 kB
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _dec, _class, _class2, _temp2; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } import PropTypes from 'prop-types'; import React, { Component } from 'react'; import { connect } from 'react-redux'; import { deviceWidthChanged, previewDateChanged } from '../../actions/preview'; import PreviewFrame from './PreviewFrame'; import PreviewToolbar from './PreviewToolbar'; var PreviewWindow = (_dec = connect(function (_ref) { var preview = _ref.preview; return { preview: preview }; }), _dec(_class = (_temp2 = _class2 = function (_Component) { _inherits(PreviewWindow, _Component); function PreviewWindow() { var _temp, _this, _ret; _classCallCheck(this, PreviewWindow); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.handleDeviceWidthChange = function (deviceWidth) { _this.props.dispatch(deviceWidthChanged(deviceWidth)); }, _this.handleDateChange = function (date) { _this.props.dispatch(previewDateChanged(date)); }, _temp), _possibleConstructorReturn(_this, _ret); } PreviewWindow.prototype.render = function render() { return React.createElement( 'div', { className: 'preview-window' }, React.createElement(PreviewToolbar, { date: this.props.preview.date, deviceWidth: this.props.preview.deviceWidth, onDateChange: this.handleDateChange, onDeviceWidthChange: this.handleDeviceWidthChange }), React.createElement(PreviewFrame, _extends({}, this.props.preview, { onTitleChange: this.props.onTitleChange })) ); }; return PreviewWindow; }(Component), _class2.propTypes = { onTitleChange: PropTypes.func }, _temp2)) || _class); export { PreviewWindow as default };