UNPKG

@shopgate/engage

Version:
39 lines (38 loc) 1.44 kB
import React, { Fragment, memo } from 'react'; import PropTypes from 'prop-types'; import Portal from '@shopgate/pwa-common/components/Portal'; import { PRODUCT_SHIPPING, PRODUCT_SHIPPING_AFTER, PRODUCT_SHIPPING_BEFORE } from '@shopgate/pwa-common-commerce/product/constants/Portals'; import PlaceholderLabel from '@shopgate/pwa-ui-shared/PlaceholderLabel'; import Label from "./components/Label"; import connect from "./connector"; import styles from "./style"; /** * The Shipping Info component. * @param {Object} props The component props. * @return {JSX} */ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime"; const Shipping = ({ shipping }) => /*#__PURE__*/_jsxs(_Fragment, { children: [/*#__PURE__*/_jsx(Portal, { name: PRODUCT_SHIPPING_BEFORE }), /*#__PURE__*/_jsx(Portal, { name: PRODUCT_SHIPPING, children: /*#__PURE__*/_jsx(PlaceholderLabel, { className: styles.placeholder, ready: shipping !== null, children: shipping && typeof shipping.price !== 'undefined' && shipping.price !== null && /*#__PURE__*/_jsx(Label, { className: `${styles.shipping} engage__product__header__shipping`, price: shipping.price, currency: shipping.currency }) }) }), /*#__PURE__*/_jsx(Portal, { name: PRODUCT_SHIPPING_AFTER })] }); Shipping.defaultProps = { shipping: null }; export default connect(/*#__PURE__*/memo(Shipping));