UNPKG

@shopgate/engage

Version:
5 lines 1.73 kB
import _isEmpty from"lodash/isEmpty";import _every from"lodash/every";import React from'react';import CardListItem from'@shopgate/pwa-ui-shared/CardList/components/Item';import{Accordion}from'@shopgate/engage/components';import{StoreOpeningHours,StorePhoneNumber}from'@shopgate/engage/locations';import{CartItemGroupReservationLabel}from"./CartItemGroupReservationLabel";import connect from"./CartItem.connector";import{accordionToggle,addressDetails,simpleLabel}from"./CartItemGroup.style";/** * Renders the product group. * @param {Object} props The component props. * @returns {JSX.Element} */function CartItemGroupReservation(_ref){var location=_ref.location,fulfillmentMethod=_ref.fulfillmentMethod;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){return React.createElement(CardListItem,{className:simpleLabel.toString()},React.createElement(CartItemGroupReservationLabel,{location:location,fulfillmentMethod:fulfillmentMethod}));}return React.createElement(CardListItem,null,React.createElement(Accordion,{renderLabel:function renderLabel(){return React.createElement(CartItemGroupReservationLabel,{location:location,fulfillmentMethod:fulfillmentMethod});},className:accordionToggle},React.createElement("div",{className:addressDetails},React.createElement(StoreOpeningHours,{hours:operationHours}),React.createElement(StorePhoneNumber,{phone:phoneNumber}))));}CartItemGroupReservation.defaultProps={location:null,fulfillmentMethod:null};export default connect(CartItemGroupReservation);