UNPKG

wix-style-react

Version:
95 lines (77 loc) 3.84 kB
import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; import _createClass from "@babel/runtime/helpers/createClass"; import _inherits from "@babel/runtime/helpers/inherits"; import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; import _defineProperty from "@babel/runtime/helpers/defineProperty"; function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } import React from 'react'; import PropTypes from 'prop-types'; import { dataHooks } from './constants'; import { st, classes } from './MobilePreviewWidget.st.css'; import PreviewWidget from '../PreviewWidget'; /** Mobile preview widget */ var MobilePreviewWidget = /*#__PURE__*/function (_React$PureComponent) { _inherits(MobilePreviewWidget, _React$PureComponent); var _super = _createSuper(MobilePreviewWidget); function MobilePreviewWidget() { _classCallCheck(this, MobilePreviewWidget); return _super.apply(this, arguments); } _createClass(MobilePreviewWidget, [{ key: "render", value: function render() { var _this$props = this.props, dataHook = _this$props.dataHook, skin = _this$props.skin, backgroundColor = _this$props.backgroundColor, height = _this$props.height, width = _this$props.width, children = _this$props.children; return /*#__PURE__*/React.createElement(PreviewWidget, { className: st(classes.root), dataHook: dataHook, skin: skin, backgroundColor: backgroundColor, height: height, width: width }, /*#__PURE__*/React.createElement("div", { "data-hook": dataHooks.mobileHeader, className: classes.header }, /*#__PURE__*/React.createElement("div", { className: classes.speaker }), /*#__PURE__*/React.createElement("div", { className: classes.camera })), /*#__PURE__*/React.createElement("div", { "data-hook": dataHooks.mobileContent, className: classes.content }, children), /*#__PURE__*/React.createElement("div", { "data-hook": dataHooks.mobileFooter, className: classes.footer })); } }]); return MobilePreviewWidget; }(React.PureComponent); _defineProperty(MobilePreviewWidget, "displayName", 'MobilePreviewWidget'); _defineProperty(MobilePreviewWidget, "propTypes", { /** Mobile preview widget data hook*/ dataHook: PropTypes.string, /** Background skin. To use `custom` skin, set it to `custom` and use the `backgroundColor` prop*/ skin: PropTypes.oneOf(['neutral', 'gradient', 'custom']), /** Mobile preview widget background color. Can be set with `design system` colors*/ backgroundColor: PropTypes.string, /** Sets the height of the component.*/ height: PropTypes.string, /** Sets the width of the component */ width: PropTypes.string, /** Node to preview */ children: PropTypes.node.isRequired }); _defineProperty(MobilePreviewWidget, "defaultProps", { skin: 'neutral', height: '100%', width: '100%' }); export default MobilePreviewWidget;