UNPKG

@shopgate/engage

Version:
6 lines 1.76 kB
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} */export var FulfillmentSheetContent=function FulfillmentSheetContent(_ref){var _ref$allowClose=_ref.allowClose,allowClose=_ref$allowClose===void 0?true:_ref$allowClose;var _React$useContext=React.useContext(FulfillmentContext),isStage=_React$useContext.isStage,title=_React$useContext.title,isOpen=_React$useContext.isOpen,handleClose=_React$useContext.handleClose,isLoading=_React$useContext.isLoading;return React.createElement(SheetDrawer,{isOpen:isOpen,title:title,onDidClose:handleClose,allowClose:allowClose,isLoading:isLoading},React.createElement("div",{className:sheet},isStage(STAGE_SELECT_STORE)&&React.createElement(StoreList,null),isStage(STAGE_RESERVE_FORM)&&React.createElement(ReserveForm,null),isStage(STAGE_RESPONSE_SUCCESS)&&React.createElement(ReservationSuccess,null),isStage(STAGE_RESPONSE_ERROR)&&React.createElement(ReservationError,null),isStage(STAGE_FULFILLMENT_METHOD)&&React.createElement(FulfillmentPath,null)));};FulfillmentSheetContent.defaultProps={allowClose:true};