@shopgate/engage
Version:
Shopgate's ENGAGE library.
5 lines • 1.83 kB
JavaScript
import _isEmpty from"lodash/isEmpty";import _every from"lodash/every";import*as React from'react';import{ResponsiveContainer}from'@shopgate/engage/components';import{useCartItem}from"../CartItem";import{CartItemCardReservationLabel}from"./CartItemCardReservationLabel";import connect from"./CartItem.connector";import{CartItemCardReservationAccordion}from"./CartItemCardReservationAccordion";import{accordionToggle}from"./CartItemCard.style";/**
* Renders the cart item card reservation block,
* @param {Object} props The component props.
* @returns {JSX.Element}
*/function CartItemCardReservation(_ref){var location=_ref.location,fulfillmentMethod=_ref.fulfillmentMethod;var _useCartItem=useCartItem(),isOrderDetails=_useCartItem.isOrderDetails;if(!location){return null;}var operationHours=location.operationHours,_location$address=location.address,_location$address2=_location$address===void 0?{}:_location$address,phoneNumber=_location$address2.phoneNumber;if((!operationHours||_every(operationHours,_isEmpty))&&!phoneNumber&&(!location.address||!location.address.street)){return React.createElement("div",{className:accordionToggle},React.createElement(CartItemCardReservationLabel,{location:location,fulfillmentMethod:fulfillmentMethod}));}return React.createElement(React.Fragment,null,React.createElement(ResponsiveContainer,{webOnly:true,breakpoint:">xs"},!isOrderDetails&&React.createElement(CartItemCardReservationAccordion,{openWithChevron:true,location:location,fulfillmentMethod:fulfillmentMethod,operationHours:operationHours})),React.createElement(ResponsiveContainer,{appAlways:true,breakpoint:"<=xs"},!isOrderDetails&&React.createElement(CartItemCardReservationAccordion,{location:location,fulfillmentMethod:fulfillmentMethod,operationHours:operationHours})));}export default connect(CartItemCardReservation);