@gocrisp/react-store-locator
TypeScript icon, indicating that this package has built-in type declarations

0.5.8 • Public • Published

@gocrisp/react-store-locator

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.

Readme

Keywords

none

Package Sidebar

Install

npm i @gocrisp/react-store-locator

Weekly Downloads

1

Version

0.5.8

License

MIT

Unpacked Size

123 kB

Total Files

9

Last publish

Collaborators

  • thascius
  • jengettings
  • daggerrz
  • ashley.fisher