UNPKG

@shopgate/engage

Version:
5 lines 1 kB
import React,{useContext,forwardRef}from'react';import{CardList}from'@shopgate/engage/components';import{StoreFinderContext}from"../../locations.context";import{StoreContext}from"./Store.context";import StoreFinderLocation from"./StoreFinderLocation";import{container,cardList,card}from"./StoreFinderLocations.style";/** * @param {Object} props The component props * @param {Object} ref A forwarded ref * @returns {JSX} */var StoreFinderLocations=function StoreFinderLocations(props,ref){var _useContext=useContext(StoreFinderContext),locations=_useContext.locations;if(!locations||locations.length===0){return null;}return React.createElement("div",{ref:ref,className:container},React.createElement(CardList,{className:cardList},locations.map(function(location){return React.createElement(CardList.Item,{className:card,key:location.code},React.createElement(StoreContext.Provider,{value:location},React.createElement(StoreFinderLocation,null)));})));};export default forwardRef(StoreFinderLocations);