# next-store-locator

> React port of jquery store-locator plugin.

Latest version **1.0.6** (published 2024-02-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install next-store-locator
pnpm add next-store-locator
yarn add next-store-locator
bun add next-store-locator
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2024-02-06 |
| First published | 2024-02-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 614.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | darkmasta |
| Maintainers | darkmasta |
| Keywords | next-store-locator, store-locator |

## Links

- npm: https://www.npmjs.com/package/next-store-locator
- npm.io page: https://npm.io/package/next-store-locator

## Dependencies (5)

- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [framer-motion](https://npm.io/package/framer-motion.md) ^11.0.3
- [@vitejs/plugin-react](https://npm.io/package/@vitejs/plugin-react.md) ^4.2.1
- [@googlemaps/js-api-loader](https://npm.io/package/@googlemaps/js-api-loader.md) ^1.16.2
- [@google/markerclustererplus](https://npm.io/package/@google/markerclustererplus.md) ^5.1.3

## Recent versions

- 1.0.6 (latest) — 2024-02-06

## README

# Next Store Locator Test

A React component for easily integrating Google Maps Store Locator feature into Next.js applications.
Check [working example](https://next-store-locator-pibyka5be-darkmasta.vercel.app/).

## Installation

```bash
npm install next-store-locator-test
# or
yarn add next-store-locator-test
```

## Usage

First, import the CSS for `next-store-locator-test` at the top of your application or component to ensure the styles are loaded:

```javascript
import 'next-store-locator-test/dist/style.css';
```

Here's a basic example to integrate the `NextStoreLocator` component into your Next.js app:

```jsx
import React, { useEffect, useState } from 'react';
import NextStoreLocator from 'next-store-locator-test';

const mapOptions = {
  center: { lat: 40.7128, lng: -74.0060 },
  zoom: 10,
  mapTypeControl: false,
  streetViewControl: false,
  fullscreenControl: false,
  styles: [{ featureType: 'poi', elementType: 'labels', stylers: [{ visibility: 'off' }] }],
};

const Page = () => {
  const [locations, setLocations] = useState([]);

  useEffect(() => {
    async function fetchLocations() {
      const response = await fetch('https://www.milestone.de/api/getstorelocatorlist');
      const data = await response.json();
      setLocations(data);
    }
    fetchLocations();
  }, []);

  return (
    <main className="w-full pt-8">
      <div className="w-full inline-flex justify-center pb-8">
        <h1 className="text-3xl font-bold">Next Store Locator</h1>
      </div>
      {locations.length > 0 && (
        <NextStoreLocator
          locationsProp={locations}
          mapOptionsProp={mapOptions}
          iconPaths={{ markerIcon: 'images/custom-marker.png' }}
          apiKey={"YOUR_GOOGLE_MAPS_API_KEY"}
        />
      )}
    </main>
  );
};

export default Page;
```

Replace `"YOUR_GOOGLE_MAPS_API_KEY"` with your actual Google Maps API key.

## Features

- Easily integrate a store locator in your Next.js projects.
- Customizable map options and styles.
- Dynamic loading of store locations.

For more advanced usage and customization options, please refer to the official documentation.

## License

Specify your package's license here, typically "MIT".

---
_Source: https://npm.io/package/next-store-locator · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
