UNPKG

@shopgate/engage

Version:
5 lines 1.1 kB
import React,{useCallback,useContext}from'react';import{RippleButton}from'@shopgate/engage/components';import{StoreContext}from"./Store.context";import{i18n}from"../../../core";import{StoreFinderContext}from"../../locations.context";import{selectLocationButton,selectLocationButtonWrapper}from"../StoreList/Store.style";/** * The StoreFinderSelectLocationButton component. * Renders if route query.selectLocation param is passed * @returns {JSX.Element} */export var StoreFinderSelectLocationButton=function StoreFinderSelectLocationButton(){var store=useContext(StoreContext);var _useContext=useContext(StoreFinderContext),selectLocation=_useContext.selectLocation,isLoading=_useContext.isLoading;var handleClick=useCallback(function(e){e.stopPropagation();selectLocation(store);},[selectLocation,store]);return React.createElement("div",{className:selectLocationButtonWrapper},React.createElement(RippleButton,{onClick:handleClick,className:selectLocationButton.toString(),disabled:isLoading||(store===null||store===void 0?void 0:store.isComingSoon)},i18n.text('locations.select_location')));};