@shopgate/engage
Version:
Shopgate's ENGAGE library.
36 lines (35 loc) • 1.22 kB
JavaScript
import React from 'react';
import PropTypes from 'prop-types';
import { i18n } from '@shopgate/engage/core';
import { LocationIcon } from '@shopgate/engage/components';
import { BOPIS } from '@shopgate/engage/locations';
import { address, addressIcon, title } from "./CartItemGroup.style";
/** @typedef {import('@shopgate/engage/locations/locations.types').LocationAware} LocationAware */
/**
* Renders the cart reservation group label.
* @param {LocationAware} props The component props.
* @returns {JSX.Element|null}
*/
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
export function CartItemGroupReservationLabel({
location,
fulfillmentMethod
}) {
if (!location) {
return null;
}
const suffix = fulfillmentMethod === BOPIS ? 'bopis' : 'ropis';
return /*#__PURE__*/_jsxs("div", {
className: address,
children: [/*#__PURE__*/_jsx("div", {
className: addressIcon,
children: /*#__PURE__*/_jsx(LocationIcon, {})
}), /*#__PURE__*/_jsxs("div", {
children: [/*#__PURE__*/_jsx("div", {
className: title,
children: i18n.text(`locations.method.${suffix}`)
}), location.name]
})]
});
}
export default CartItemGroupReservationLabel;