UNPKG

@shopgate/pwa-common

Version:

Common library for the Shopgate Connect PWA.

48 lines (46 loc) 1.25 kB
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose"; import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { objectWithoutProps } from "../../helpers/data"; import GridItem from "./components/Item"; import styles, { wrap } from "./style"; /** * The grid component. */ let Grid = /*#__PURE__*/function (_Component) { function Grid() { return _Component.apply(this, arguments) || this; } _inheritsLoose(Grid, _Component); var _proto = Grid.prototype; /** * Composes the props. * @returns {Object} The composed props. */ _proto.getProps = function getProps() { let className = `${this.props.className} ${styles} common__grid`; if (this.props.wrap) { className += ` ${wrap(this.props.wrap)}`; } const props = { ...this.props, className }; return objectWithoutProps(props, ['wrap', 'component']); } /** * Renders the component. * @returns {JSX} */; _proto.render = function render() { return /*#__PURE__*/React.createElement(this.props.component, this.getProps()); }; return Grid; }(Component); Grid.Item = GridItem; Grid.defaultProps = { className: '', component: 'ul', wrap: false }; export default Grid;