wix-style-react
Version:
110 lines (92 loc) • 4.8 kB
JavaScript
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";
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 { st, classes } from './MarketingPageLayout.st.css';
import { dataHooks } from './constants';
import { Layout, Cell } from '../Layout';
import Divider from '../Divider';
/** Marketing Page Layout */
var MarketingPageLayout = /*#__PURE__*/function (_React$PureComponent) {
_inherits(MarketingPageLayout, _React$PureComponent);
var _super = _createSuper(MarketingPageLayout);
function MarketingPageLayout() {
_classCallCheck(this, MarketingPageLayout);
return _super.apply(this, arguments);
}
_createClass(MarketingPageLayout, [{
key: "render",
value: function render() {
var _this$props = this.props,
dataHook = _this$props.dataHook,
className = _this$props.className,
horizontalSize = _this$props.horizontalSize,
verticalSize = _this$props.verticalSize,
removeImageHorizontalPadding = _this$props.removeImageHorizontalPadding,
removeImageVerticalPadding = _this$props.removeImageVerticalPadding,
content = _this$props.content,
image = _this$props.image,
footer = _this$props.footer;
return /*#__PURE__*/React.createElement("div", {
"data-hook": dataHook,
className: st(classes.root, {
horizontalSize: horizontalSize,
verticalSize: verticalSize,
removeImageHorizontalPadding: removeImageHorizontalPadding,
removeImageVerticalPadding: removeImageVerticalPadding
}, className)
}, /*#__PURE__*/React.createElement(Layout, {
gap: 0
}, content && /*#__PURE__*/React.createElement(Cell, {
span: 6
}, /*#__PURE__*/React.createElement("div", {
"data-hook": dataHooks.contentContainer,
className: classes.contentContainer
}, content)), image && /*#__PURE__*/React.createElement(Cell, {
span: 6
}, /*#__PURE__*/React.createElement("div", {
"data-hook": dataHooks.imageContainer,
className: classes.imageContainer
}, image)), footer && /*#__PURE__*/React.createElement(Cell, {
span: 12
}, /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement("div", {
"data-hook": dataHooks.footerContainer,
className: classes.footerContainer
}, footer))));
}
}]);
return MarketingPageLayout;
}(React.PureComponent);
MarketingPageLayout.displayName = 'MarketingPageLayout';
MarketingPageLayout.propTypes = {
/** Applies a data-hook HTML attribute that can be used in the tests. */
dataHook: PropTypes.string,
/** Specifies a CSS class name to be appended to the component’s root element. */
className: PropTypes.string,
/** Controls horizontal padding size. */
horizontalSize: PropTypes.oneOf(['medium', 'large']),
/** Controls vertical padding size. */
verticalSize: PropTypes.oneOf(['medium', 'large']),
/** Specifies whether to remove image side paddings. */
removeImageHorizontalPadding: PropTypes.bool,
/** Specifies whether to remove image vertical paddings. */
removeImageVerticalPadding: PropTypes.bool,
/** Defines page content. In the majority of cases should use `<MarketingPageLayoutContent/>` component as a content. */
content: PropTypes.node,
/** Accepts link to an image source or a custom media element. */
image: PropTypes.node,
/** Accepts content to be displayed at the bottom of a page. */
footer: PropTypes.node
};
MarketingPageLayout.defaultProps = {
horizontalSize: 'large',
verticalSize: 'large',
removeImageHorizontalPadding: false,
removeImageVerticalPadding: false
};
export default MarketingPageLayout;