Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

feat(geo): add Marker & HTMLMarker interactions [PART-8] #1227

Merged
merged 26 commits into from
Jun 20, 2018

Conversation

samouss
Copy link
Collaborator

@samouss samouss commented May 11, 2018

Summary

This is the eighth part of the GeoSearch widget. The PR introduces the ability to attach event handlers on both markers (<Marker> & <HTMLMarker>). We also moved the options to be top level for <GeoSearch>, <Marker>, <HTMLMarker>. There is no more the mapOptions & options props. You can pass the option directly to the component.

This PR includes:

  • utils: create some utility functions to register the listeners, filter props, etc...
  • createHTMLMarker: update the addListener signature to match the one from Google Maps. It means that we can register & remove events in the same way for both implementations.
  • <GeoSearch>: remove the mapOptions prop, now you can pass the options directly to the component. They will be forward to <GoogleMaps>.
  • <Marker>: we can now attach event listener to the marker like any other React element. But only a subset of events are available. The ones available are the ones implemented by Google Maps. We also remove the options prop, now you can pass the options directly to the component.
  • <HTMLMarker>: we can now attach event listener to the marker like any other React element. All the regular mouse events are available (except drag). We also remove the options prop, now you can pass the options directly to the component.

Usage

import { GoogleMapsLoader, GeoSearch, Marker } from "react-instantsearch-dom-geo"; // name will change

<GoogleMapsLoader apiKey="GOOGLE_MAPS_API_KEY">
  {google => (
    <GeoSearch google={google}>
      {({ hits }) => (
        <Fragment>
          {hits.map(hit => (
            <Marker
              key={hit.objectID}
              hit={hit}
              label={hit.name}
              onClick={onClickHandler}
            />
          ))}
        </Fragment>
      )}
    </GeoSearch>
  )}
</GoogleMapsLoader>

Result

You can use the widget in Storybook.

@samouss samouss requested review from vvo, bobylito and Haroenv May 11, 2018 08:41
@algobot
Copy link
Contributor

algobot commented May 11, 2018

Deploy preview for react-instantsearch ready!

Built with commit a330dee

https://deploy-preview-1227--react-instantsearch.netlify.com

@samouss samouss force-pushed the feat/geo-part-7-custom-marker branch from b7e0583 to 3f34497 Compare May 14, 2018 09:23
@samouss samouss force-pushed the feat/geo-part-8-marker-options branch from 4c00daf to 7387ab0 Compare May 14, 2018 09:24
@samouss samouss force-pushed the feat/geo-part-7-custom-marker branch from 3f34497 to b13e5d0 Compare May 14, 2018 13:11
@samouss samouss force-pushed the feat/geo-part-8-marker-options branch 2 times, most recently from 5e77b01 to ace15e8 Compare May 16, 2018 07:43
@samouss samouss force-pushed the feat/geo-part-7-custom-marker branch from b270999 to 0d7a7e4 Compare June 19, 2018 17:14
@samouss samouss force-pushed the feat/geo-part-8-marker-options branch from ace15e8 to 7b63aa2 Compare June 19, 2018 17:35
@samouss samouss force-pushed the feat/geo-part-7-custom-marker branch from 0d7a7e4 to f7477f9 Compare June 20, 2018 08:54
@samouss samouss force-pushed the feat/geo-part-8-marker-options branch from 7b63aa2 to d1267d2 Compare June 20, 2018 09:06
* feat(geo): add docs [PART-10] (#1289)
@samouss samouss merged commit 102c924 into feat/geo-part-7-custom-marker Jun 20, 2018
@samouss samouss deleted the feat/geo-part-8-marker-options branch June 20, 2018 14:00
samouss added a commit that referenced this pull request Jun 20, 2018
* feat(geo): add Marker & HTMLMarker interactions [PART-8] (#1227)

* feat(geo): add stories [PART-9] (#1236)

* feat(geo): add docs [PART-10] (#1289)
samouss added a commit that referenced this pull request Jun 20, 2018
* feat(geo): custom Marker [PART-7] (#1214)

* feat(geo): add Marker & HTMLMarker interactions [PART-8] (#1227)

* feat(geo): add stories [PART-9] (#1236)

* feat(geo): add docs [PART-10] (#1289)
samouss added a commit that referenced this pull request Jun 20, 2018
* feat(geo): refactor & external update [PART-6] (#1207)

* feat(geo): custom Marker [PART-7] (#1214)

* feat(geo): add Marker & HTMLMarker interactions [PART-8] (#1227)

* feat(geo): add stories [PART-9] (#1236)

* feat(geo): add docs [PART-10] (#1289)
samouss added a commit that referenced this pull request Jun 20, 2018
* feat(geo): add Control component [PART-5] (#1205)

* feat(geo): refactor & external update [PART-6] (#1207)

* feat(geo): custom Marker [PART-7] (#1214)

* feat(geo): add Marker & HTMLMarker interactions [PART-8] (#1227)

* feat(geo): add stories [PART-9] (#1236)

* feat(geo): add docs [PART-10] (#1289)
samouss added a commit that referenced this pull request Jun 20, 2018
* feat(geo): add Redo component [PART-4] (#1201)

* feat(geo): add Control component [PART-5] (#1205)

* feat(geo): refactor & external update [PART-6] (#1207)

* feat(geo): custom Marker [PART-7] (#1214)

* feat(geo): add Marker & HTMLMarker interactions [PART-8] (#1227)

* feat(geo): add stories [PART-9] (#1236)

* feat(geo): add docs [PART-10] (#1289)
samouss added a commit that referenced this pull request Jun 20, 2018
* feat(geo): add refine on interaction [PART-3] (#1192)

* feat(geo): add Redo component [PART-4] (#1201)

* feat(geo): add Control component [PART-5] (#1205)

* feat(geo): refactor & external update [PART-6] (#1207)

* feat(geo): custom Marker [PART-7] (#1214)

* feat(geo): add Marker & HTMLMarker interactions [PART-8] (#1227)

* feat(geo): add stories [PART-9] (#1236)

* feat(geo): add docs [PART-10] (#1289)
samouss added a commit that referenced this pull request Jun 21, 2018
* feat(geo): add simple GoogleMaps widget [PART-2] (#1189)

* feat(geo): add refine on interaction [PART-3] (#1192)

* feat(geo): add Redo component [PART-4] (#1201)

* feat(geo): add Control component [PART-5] (#1205)

* feat(geo): refactor & external update [PART-6] (#1207)

* feat(geo): custom Marker [PART-7] (#1214)

* feat(geo): add Marker & HTMLMarker interactions [PART-8] (#1227)

* feat(geo): add stories [PART-9] (#1236)

* feat(geo): add docs [PART-10] (#1289)
samouss added a commit that referenced this pull request Jul 4, 2018
<a name="5.2.0"></a>
# [5.2.0](v5.2.0-beta.2...v5.2.0) (2018-07-04)

### Bug Fixes

* **translatable:** avoid create a new function on every render ([#1383](#1383)) ([1285b3b](1285b3b))

### Features

* **core:** export translatable ([#1351](#1351)) ([6d5a89d](6d5a89d))
* **maps:** add connector & widget ([#1171](#1171)) ([16e288a](16e288a)), closes [#1189](#1189) [#1192](#1192) [#1201](#1201) [#1205](#1205) [#1207](#1207) [#1214](#1214) [#1227](#1227) [#1236](#1236) [#1289](#1289)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants