UNPKG

@shopgate/engage

Version:
39 lines (38 loc) 1.42 kB
import React, { Fragment } from 'react'; import { QuantityLabel } from '@shopgate/engage/components'; import { getTranslatedLineItemStatus } from '@shopgate/engage/orders'; import { useCartItem, useCartItemProduct } from "./CartItem.hooks"; import { column, locationColumn, statusColumn, quantityPickerDisabled } from "./CartItemProductLayoutWide.style"; /** * @returns {JSX.Element} */ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime"; const CartItemProductLayoutWide = () => { const { location, cartItem, cartIsDirectShipOnly } = useCartItem(); const { product } = useCartItemProduct(); const hasUnitWithDecimals = product.unit && product.hasCatchWeight || false; return /*#__PURE__*/_jsxs(_Fragment, { children: [!cartIsDirectShipOnly ? /*#__PURE__*/_jsx("div", { className: locationColumn, children: location?.name }) : null, /*#__PURE__*/_jsx("div", { className: statusColumn, children: getTranslatedLineItemStatus(cartItem?.status, cartItem?.subStatus) }), /*#__PURE__*/_jsx("div", { className: column, children: /*#__PURE__*/_jsx(QuantityLabel, { className: quantityPickerDisabled, value: cartItem.quantity, unit: hasUnitWithDecimals ? product.unit : null, maxDecimals: hasUnitWithDecimals ? 2 : 0 }) })] }); }; export default CartItemProductLayoutWide;