UNPKG

@shopgate/engage

Version:
5 lines 1.58 kB
import*as React from'react';import{i18n}from'@shopgate/engage/core';import{LocationIcon,ResponsiveContainer}from'@shopgate/engage/components';import{BOPIS,CartItemProductChangeLocation}from'@shopgate/engage/locations';import{useCartItem}from"../CartItem";import CartItemCardReservationLabelChangeStore from"./CartItemCardReservationLabelChangeStore";import{address,addressIcon,titles,name,method}from"./CartItemCard.style";/** * Renders the cart reservation card label. * @param {Object} props The component props. * @returns {JSX} */export function CartItemCardReservationLabel(_ref){var location=_ref.location,fulfillmentMethod=_ref.fulfillmentMethod;var _useCartItem=useCartItem(),cartItem=_useCartItem.cartItem,isEditable=_useCartItem.isEditable,registerFulfillmentAction=_useCartItem.registerFulfillmentAction;if(!location){return null;}var suffix=fulfillmentMethod===BOPIS?'bopis':'ropis';return React.createElement("div",{className:address},React.createElement("div",{className:addressIcon},React.createElement(LocationIcon,null)),React.createElement("div",{className:titles},React.createElement("div",{className:name},location.name),isEditable&&React.createElement(ResponsiveContainer,{webOnly:true,breakpoint:">xs"},React.createElement(CartItemCardReservationLabelChangeStore,null),React.createElement(CartItemProductChangeLocation,{cartItem:cartItem,registerAction:registerFulfillmentAction})),React.createElement(ResponsiveContainer,{appAlways:true,breakpoint:"<=xs"},React.createElement("div",{className:method},i18n.text("locations.method.".concat(suffix))))));}