@shopgate/engage
Version:
Shopgate's ENGAGE library.
51 lines (49 loc) • 1.72 kB
JavaScript
import React from 'react';
import PropTypes from 'prop-types';
import { Accordion } from '@shopgate/engage/components';
import { StoreAddress, StoreOpeningHours } from '@shopgate/engage/locations';
import { CartItemCardReservationLabel } from "./CartItemCardReservationLabel";
import { accordionToggle, accordionContent, locationAddress, locationHours } from "./CartItemCard.style";
// eslint-disable-next-line max-len
/** @typedef {import('@shopgate/engage/locations/locations.types').OptionalLocationAware} OptionalLocationAware */
/**
* @param {OptionalLocationAware} props The component props.
* @returns {JSX.Element}
*/
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
const CartItemCardReservationAccordion = ({
openWithChevron,
location,
fulfillmentMethod,
operationHours
}) => /*#__PURE__*/_jsx(Accordion, {
className: accordionToggle,
openWithChevron: openWithChevron,
renderLabel: () => /*#__PURE__*/_jsx(CartItemCardReservationLabel, {
location: location,
fulfillmentMethod: fulfillmentMethod
}),
children: /*#__PURE__*/_jsxs("div", {
className: accordionContent,
children: [/*#__PURE__*/_jsx("div", {
className: locationAddress,
children: /*#__PURE__*/_jsx(StoreAddress, {
address: location.address,
pure: true
})
}), operationHours && /*#__PURE__*/_jsx("div", {
className: locationHours,
children: /*#__PURE__*/_jsx(StoreOpeningHours, {
hours: operationHours,
pure: true
})
})]
})
});
CartItemCardReservationAccordion.defaultProps = {
openWithChevron: false,
location: null,
fulfillmentMethod: null,
operationHours: null
};
export { CartItemCardReservationAccordion };