UNPKG

@shopgate/engage

Version:
42 lines (41 loc) 1.5 kB
import React from 'react'; import PropTypes from 'prop-types'; import CartItemCardReservation from "./CartItemCardReservation"; import { withBorder } from "./CartItemCard.style"; /** * Renders the cart items. * @param {Object} props The component props. * @param {React.ReactNode} props.children The child components. * @param {string|null} [props.fulfillmentLocationId] The fulfillment location ID. * @param {boolean} [props.multiLineReservation=false] Whether multi-line reservation is enabled. * @param {string|null} [props.fulfillmentMethod] The fulfillment method. * @param {boolean} [props.hasMessages=false] Whether the cart item has messages. * @returns {JSX.Element} The rendered component. */ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime"; export const CartItemCard = ({ children, fulfillmentLocationId, multiLineReservation, fulfillmentMethod, hasMessages }) => { if (!multiLineReservation) { return children; } return /*#__PURE__*/_jsxs(_Fragment, { children: [/*#__PURE__*/_jsx("ul", { className: fulfillmentLocationId && !hasMessages ? withBorder : null, children: children }), !!fulfillmentLocationId && /*#__PURE__*/_jsx(CartItemCardReservation, { locationId: fulfillmentLocationId, fulfillmentMethod: fulfillmentMethod })] }); }; CartItemCard.defaultProps = { fulfillmentLocationId: null, multiLineReservation: false, fulfillmentMethod: null, hasMessages: false };