Skip to content
This repository has been archived by the owner on May 12, 2023. It is now read-only.

Latest commit

 

History

History
50 lines (33 loc) · 2.35 KB

README.md

File metadata and controls

50 lines (33 loc) · 2.35 KB

@gocrisp/react-store-locator

Archival note: The Crisp GeoJSON outbound connector is deprecated and no longer available.

Package Version MIT License

React version of Crisp's store locator component. Intended for use with the Crisp GeoJSON connector.

This uses the Google Maps JavaScript API to easily create a simple store locator from any GeoJSON source.

Please refer to our example page to see this package in action and for more advanced usage examples. The steps below will provide the minimum for creating a store locator with React.

Create a Store Locator

Set up services

First, go set up a GeoJSON outbound connector on https://platform.gocrisp.com/. It will give you a URL to use later.

Create a Google Maps API Key with the following APIs enabled:

  • Maps JavaScript API
  • Places API
  • Distance Matrix API.
  • Street View Static API

Simple Implementation

Install this package

yarn add @gocrisp/react-store-locator

or

npm install @gocrisp/react-store-locator --save

Include the styles: We have some minimal styles included as plain css in @gocrisp/react-store-locator/dist/react-store-locator.css. You will need to pull this into your site however you are including styles. We've kept the definitions as minimal as possible so that you can easily override or recreate the styles yourself. And every class is namespaced with the map_ prefix to avoid collisions.

Then, wherever you want to include the store locator map, insert this snippet:

import { StoreLocator } from '@gocrisp/react-store-locator';

<StoreLocator 
  geoJson="<URL from the GeoJSON connector>"
  loaderOptions={{ apiKey: '<your Google Maps API key>' }}
/>

Most of the Google Maps JavaScript API options and objects are available for customization as well. More details are available in the examples and documentation.