@shopgate/engage
Version:
Shopgate's ENGAGE library.
78 lines (77 loc) • 2.95 kB
JavaScript
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { I18n } from '@shopgate/engage/components';
import { header, column, priceColumnWide, imageColumn, detailsColumn, locationColumn, contextMenuColumn, quantityPickerColumn, quantityPickerColumnNotEditable } from "./CartItemsHeaderWide.style";
import connect from "./CartItemsHeaderWide.connector";
/**
* The CartItemsHeaderWide component.
* @param {Object} props The component props.
* @param {boolean} [props.editable=true] Whether the cart is editable.
* @param {boolean} [props.isOrderDetails=false] Whether the component is used in order details.
* @param {boolean} [props.isDirectShipOnly=false] Whether the cart is direct ship only.
* @param {boolean} [props.hasLineItemPromotions=false] Whether the cart has line item promotions.
* @param {number} props.enabledFulfillmentMethodsCount The count of enabled fulfillment methods.
* @returns {JSX.Element} The rendered component.
*/
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
const CartItemsHeaderWide = ({
editable,
isOrderDetails,
enabledFulfillmentMethodsCount,
hasLineItemPromotions,
isDirectShipOnly
}) => /*#__PURE__*/_jsxs("div", {
className: header,
children: [/*#__PURE__*/_jsx("div", {
className: imageColumn,
children: /*#__PURE__*/_jsx(I18n.Text, {
string: "cart.items"
})
}), /*#__PURE__*/_jsx("div", {
className: detailsColumn
}), /*#__PURE__*/_jsx("div", {
className: classNames(column.toString(), {
[priceColumnWide]: hasLineItemPromotions
}),
children: /*#__PURE__*/_jsx(I18n.Text, {
string: "cart.price"
})
}), isOrderDetails && /*#__PURE__*/_jsxs(_Fragment, {
children: [!isDirectShipOnly ? /*#__PURE__*/_jsx("div", {
className: locationColumn,
children: /*#__PURE__*/_jsx(I18n.Text, {
string: "cart.location"
})
}) : null, /*#__PURE__*/_jsx("div", {
className: column,
children: /*#__PURE__*/_jsx(I18n.Text, {
string: "cart.status"
})
}), /*#__PURE__*/_jsx("div", {
className: column,
children: /*#__PURE__*/_jsx(I18n.Text, {
string: "cart.fulfilled_quantity"
})
})]
}), /*#__PURE__*/_jsx("div", {
className: editable ? quantityPickerColumn : quantityPickerColumnNotEditable,
children: /*#__PURE__*/_jsx(I18n.Text, {
string: isOrderDetails ? 'cart.ordered_quantity' : 'cart.quantity'
})
}), /*#__PURE__*/_jsx("div", {
className: column,
children: /*#__PURE__*/_jsx(I18n.Text, {
string: "cart.subtotal"
})
}), editable && enabledFulfillmentMethodsCount > 1 && /*#__PURE__*/_jsx("div", {
className: contextMenuColumn
})]
});
CartItemsHeaderWide.defaultProps = {
editable: true,
isOrderDetails: false,
isDirectShipOnly: false,
hasLineItemPromotions: false
};
export default connect(CartItemsHeaderWide);