@shopgate/engage
Version:
Shopgate's ENGAGE library.
43 lines (42 loc) • 1.76 kB
JavaScript
import * as React from 'react';
import PropTypes from 'prop-types';
import { FulfillmentContext } from "../../locations.context";
import { STAGE_SELECT_STORE, STAGE_RESERVE_FORM, STAGE_RESPONSE_SUCCESS, STAGE_RESPONSE_ERROR, STAGE_FULFILLMENT_METHOD } from "../../constants";
import SheetDrawer from "../../../components/SheetDrawer";
import { StoreList } from "../StoreList";
import { ReserveForm } from "../ReserveForm";
import { ReservationSuccess, ReservationError } from "../ReservationResponses";
import { FulfillmentPath } from "../FulfillmentPath";
import { sheet } from "./FulfillmentSheet.style";
/**
* Renders the content of the fulfillment sheet.
* @param {Object} props The component props.
* @param {boolean} props.allowClose Whether the sheet can be closed via a button
* @return {JSX.Element}
*/
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
export const FulfillmentSheetContent = ({
allowClose = true
}) => {
const {
isStage,
title,
isOpen,
handleClose,
isLoading
} = React.useContext(FulfillmentContext);
return /*#__PURE__*/_jsx(SheetDrawer, {
isOpen: isOpen,
title: title,
onDidClose: handleClose,
allowClose: allowClose,
isLoading: isLoading,
children: /*#__PURE__*/_jsxs("div", {
className: sheet,
children: [isStage(STAGE_SELECT_STORE) && /*#__PURE__*/_jsx(StoreList, {}), isStage(STAGE_RESERVE_FORM) && /*#__PURE__*/_jsx(ReserveForm, {}), isStage(STAGE_RESPONSE_SUCCESS) && /*#__PURE__*/_jsx(ReservationSuccess, {}), isStage(STAGE_RESPONSE_ERROR) && /*#__PURE__*/_jsx(ReservationError, {}), isStage(STAGE_FULFILLMENT_METHOD) && /*#__PURE__*/_jsx(FulfillmentPath, {})]
})
});
};
FulfillmentSheetContent.defaultProps = {
allowClose: true
};