From c8a7f56261b7ddc0b80398e4d1f2e8bbd566ba2d Mon Sep 17 00:00:00 2001 From: Michael Salaverry Date: Tue, 5 Mar 2019 07:41:46 +0200 Subject: [PATCH] Documentation: added PropTypes for heatmap prop (#716) * Documentation: added PropTypes for heatmap prop This PR improves the documentation of the heatmap prop by adding types. I don't mind adding PropTypes validation to this prop as well if you are interested in that. * Update API.md I added some spacing between the interface and the example snippet. I also added a link to the example I wrote for the other repository. I think we should delay this PR until that example is live. That way, the new Demo link will go to live functioning code rather than no where. --- API.md | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/API.md b/API.md index c39549d..6c1ee56 100644 --- a/API.md +++ b/API.md @@ -347,9 +347,25 @@ For more details see the [google documentation](https://developers.google.com/ma ### Heatmap Layer -For enabling heatmap layer, just add `heatmapLibrary={true}` and provide data for heatmap in `heatmap` as props. +To use the heatmap layer, add `heatmapLibrary={true}` to add the visualizations library, and provide the data&configuration for the heatmap in `heatmap` as props. -#### Example +The typescript interface for the heatmap prop is as follows: +```typescript +interface heatmapProp { + positions: { + lat: Number; + lng: Number; + weight?: Number; + }[]; + options: { + radius?: number; + opacity?: number; + /* other options directly from Google Heatmaps API */ + }; +} +``` + +#### Example [Demo](https://google-map-react.github.io/google-map-react-examples/heatmap) ```javascript