@shopgate/engage
Version:
Shopgate's ENGAGE library.
3 lines • 1.17 kB
JavaScript
import React,{useMemo}from'react';import PropTypes from'prop-types';import{RippleButton,I18n}from'@shopgate/engage/components';import{i18n}from'@shopgate/engage/core';import{wrapper,heading,name,button}from"./FulfillmentSlotSwitcherDefault.style";import{getTimeSlotDisplayText}from"./time";/**
* @returns {JSX}
*/var FulfillmentSlotSwitcherDefault=function FulfillmentSlotSwitcherDefault(_ref){var handleChange=_ref.handleChange,fulfillmentSlot=_ref.fulfillmentSlot,editable=_ref.editable;var displayTime=useMemo(function(){return getTimeSlotDisplayText(fulfillmentSlot);},[fulfillmentSlot]);return React.createElement("div",{className:wrapper},React.createElement("div",{className:heading},i18n.text('locations.your_current_timeslot.heading')),React.createElement("div",{className:name},React.createElement("span",null,displayTime),React.createElement(RippleButton,{onClick:handleChange,type:"secondary",className:button,disabled:!editable,flat:true},React.createElement(I18n.Text,{string:"locations.your_current_location.change"}))));};FulfillmentSlotSwitcherDefault.defaultProps={fulfillmentSlot:null,editable:true};export default FulfillmentSlotSwitcherDefault;