From 03dd851439a7fcb166d0d260f669c96ad9978f6f Mon Sep 17 00:00:00 2001 From: Rebecca Black Date: Fri, 8 Mar 2024 14:21:55 -0500 Subject: [PATCH 1/9] added buffer prop to placemarker --- .../core-data/src/components/PlaceMarker.js | 8 +++++- .../src/core-data/PlaceMarker.stories.js | 25 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/packages/core-data/src/components/PlaceMarker.js b/packages/core-data/src/components/PlaceMarker.js index 9a0ba749..297b4deb 100644 --- a/packages/core-data/src/components/PlaceMarker.js +++ b/packages/core-data/src/components/PlaceMarker.js @@ -7,7 +7,12 @@ type Props = { /** * The URL of the Core Data place record. */ - url: string + url: string, + + /** + * The number of miles to buffer the GeoJSON data. (Defaults to 2.) + */ + buffer?: number }; /** @@ -52,6 +57,7 @@ const PlaceMarker = (props: Props) => { return ( ); }; diff --git a/packages/storybook/src/core-data/PlaceMarker.stories.js b/packages/storybook/src/core-data/PlaceMarker.stories.js index 2829d5e8..edb7a9cf 100644 --- a/packages/storybook/src/core-data/PlaceMarker.stories.js +++ b/packages/storybook/src/core-data/PlaceMarker.stories.js @@ -36,3 +36,28 @@ export const Default = () => ( ); + +export const LargerBuffer = () => ( + + + + + +
+ +
+
+
+); From ea0d772b51c6bfc817b22c39a117f8df021d27fa Mon Sep 17 00:00:00 2001 From: Rebecca Black Date: Mon, 11 Mar 2024 09:50:39 -0400 Subject: [PATCH 2/9] put props in alphabetical order --- packages/core-data/src/components/PlaceMarker.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/core-data/src/components/PlaceMarker.js b/packages/core-data/src/components/PlaceMarker.js index 297b4deb..92a147e3 100644 --- a/packages/core-data/src/components/PlaceMarker.js +++ b/packages/core-data/src/components/PlaceMarker.js @@ -5,14 +5,14 @@ import React, { useCallback, useEffect, useState } from 'react'; type Props = { /** - * The URL of the Core Data place record. + * The number of miles to buffer the GeoJSON data. (Defaults to 2.) */ - url: string, + buffer?: number, /** - * The number of miles to buffer the GeoJSON data. (Defaults to 2.) + * The URL of the Core Data place record. */ - buffer?: number + url: string }; /** From 0d93c4771b8a583f8fbbc78f64713c7d457f67f1 Mon Sep 17 00:00:00 2001 From: Rebecca Black Date: Fri, 8 Mar 2024 14:21:55 -0500 Subject: [PATCH 3/9] added buffer prop to placemarker --- .../core-data/src/components/PlaceMarker.js | 0 .../src/core-data/PlaceMarker.stories.js | 25 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 packages/core-data/src/components/PlaceMarker.js diff --git a/packages/core-data/src/components/PlaceMarker.js b/packages/core-data/src/components/PlaceMarker.js new file mode 100644 index 00000000..e69de29b diff --git a/packages/storybook/src/core-data/PlaceMarker.stories.js b/packages/storybook/src/core-data/PlaceMarker.stories.js index a91a4274..9746770e 100644 --- a/packages/storybook/src/core-data/PlaceMarker.stories.js +++ b/packages/storybook/src/core-data/PlaceMarker.stories.js @@ -61,3 +61,28 @@ export const MultiplePlaces = () => ( ); + +export const LargerBuffer = () => ( + + + + + +
+ +
+
+
+); From aec0995b75d074bd4bd2b70c6d2c05ab7aa839b3 Mon Sep 17 00:00:00 2001 From: Rebecca Black Date: Tue, 12 Mar 2024 12:21:49 -0400 Subject: [PATCH 4/9] update placemarkers component with buffer prop --- .../core-data/src/components/PlaceMarker.js | 0 .../core-data/src/components/PlaceMarkers.js | 6 +++++ .../src/core-data/PlaceMarker.stories.js | 26 +------------------ 3 files changed, 7 insertions(+), 25 deletions(-) delete mode 100644 packages/core-data/src/components/PlaceMarker.js diff --git a/packages/core-data/src/components/PlaceMarker.js b/packages/core-data/src/components/PlaceMarker.js deleted file mode 100644 index e69de29b..00000000 diff --git a/packages/core-data/src/components/PlaceMarkers.js b/packages/core-data/src/components/PlaceMarkers.js index fc738d4e..3b66d6b1 100644 --- a/packages/core-data/src/components/PlaceMarkers.js +++ b/packages/core-data/src/components/PlaceMarkers.js @@ -13,6 +13,11 @@ import _ from 'underscore'; type Props = { animate?: boolean, + /** + * The number of miles to buffer the GeoJSON data. (Defaults to two.) + */ + buffer?: number, + /** * The URL of the Core Data place record. */ @@ -69,6 +74,7 @@ const PlaceMarkers = (props: Props) => { return ( ); diff --git a/packages/storybook/src/core-data/PlaceMarker.stories.js b/packages/storybook/src/core-data/PlaceMarker.stories.js index 578c8449..9f413b26 100644 --- a/packages/storybook/src/core-data/PlaceMarker.stories.js +++ b/packages/storybook/src/core-data/PlaceMarker.stories.js @@ -78,7 +78,7 @@ export const LargerBuffer = () => ( height: '300px' }} > - @@ -87,27 +87,3 @@ export const LargerBuffer = () => ( ); -export const LargerBuffer = () => ( - - - - - -
- -
-
-
-); From 41c2cd5963af38a6d3589e6a5195669096b54563 Mon Sep 17 00:00:00 2001 From: Rebecca Black Date: Tue, 12 Mar 2024 12:24:14 -0400 Subject: [PATCH 5/9] updated storybook placemarker to use a place not in the middle of the ocean --- packages/storybook/src/core-data/PlaceMarker.stories.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/storybook/src/core-data/PlaceMarker.stories.js b/packages/storybook/src/core-data/PlaceMarker.stories.js index 9f413b26..a72114ed 100644 --- a/packages/storybook/src/core-data/PlaceMarker.stories.js +++ b/packages/storybook/src/core-data/PlaceMarker.stories.js @@ -30,7 +30,7 @@ export const Default = () => ( > @@ -79,7 +79,9 @@ export const LargerBuffer = () => ( }} > From ea85aaf30249d91a7e3e7eaa0e34e5ebb2d950c4 Mon Sep 17 00:00:00 2001 From: Rebecca Black Date: Fri, 8 Mar 2024 14:21:55 -0500 Subject: [PATCH 6/9] added buffer prop to placemarker --- .../core-data/src/components/PlaceMarker.js | 59 +++++++++++++++++++ .../src/core-data/PlaceMarker.stories.js | 25 ++++++++ 2 files changed, 84 insertions(+) diff --git a/packages/core-data/src/components/PlaceMarker.js b/packages/core-data/src/components/PlaceMarker.js index e69de29b..9a0ba749 100644 --- a/packages/core-data/src/components/PlaceMarker.js +++ b/packages/core-data/src/components/PlaceMarker.js @@ -0,0 +1,59 @@ +// @flow + +import { LocationMarker } from '@performant-software/geospatial'; +import React, { useCallback, useEffect, useState } from 'react'; + +type Props = { + /** + * The URL of the Core Data place record. + */ + url: string +}; + +/** + * This component renders a map marker for a given Core Data Place record. + */ +const PlaceMarker = (props: Props) => { + const [place, setPlace] = useState(); + + /** + * Converts the passed data to a feature collection and sets it on the state. + * + * @type {(function(*): void)|*} + */ + const onLoad = useCallback((data) => { + const featureCollection = { + type: 'FeatureCollection', + features: [{ + ...data, + properties: { + ...data.properties, + record_id: data.record_id + } + }] + }; + + setPlace(featureCollection); + }, []); + + /** + * Fetch the place record from the passed URL. + */ + useEffect(() => { + fetch(props.url) + .then((res) => res.json()) + .then(onLoad); + }, [props.url]); + + if (!place) { + return null; + } + + return ( + + ); +}; + +export default PlaceMarker; diff --git a/packages/storybook/src/core-data/PlaceMarker.stories.js b/packages/storybook/src/core-data/PlaceMarker.stories.js index 9746770e..578c8449 100644 --- a/packages/storybook/src/core-data/PlaceMarker.stories.js +++ b/packages/storybook/src/core-data/PlaceMarker.stories.js @@ -86,3 +86,28 @@ export const LargerBuffer = () => ( ); + +export const LargerBuffer = () => ( + + + + + +
+ +
+
+
+); From dafe5b5a0bc4c0b96eeef95fbbee0c9043618fe9 Mon Sep 17 00:00:00 2001 From: Rebecca Black Date: Mon, 11 Mar 2024 09:50:39 -0400 Subject: [PATCH 7/9] put props in alphabetical order --- packages/core-data/src/components/PlaceMarker.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/core-data/src/components/PlaceMarker.js b/packages/core-data/src/components/PlaceMarker.js index 9a0ba749..086b263f 100644 --- a/packages/core-data/src/components/PlaceMarker.js +++ b/packages/core-data/src/components/PlaceMarker.js @@ -5,9 +5,14 @@ import React, { useCallback, useEffect, useState } from 'react'; type Props = { /** - * The URL of the Core Data place record. + * The number of miles to buffer the GeoJSON data. (Defaults to 2.) */ - url: string + url: string, + + /** + * The number of miles to buffer the GeoJSON data. (Defaults to 2.) + */ + buffer?: number }; /** From d1aad8949c0b3c465d6ce4828141d5ef42ffbeec Mon Sep 17 00:00:00 2001 From: Rebecca Black Date: Tue, 12 Mar 2024 12:21:49 -0400 Subject: [PATCH 8/9] update placemarkers component with buffer prop --- .../core-data/src/components/PlaceMarker.js | 64 ------------------- .../core-data/src/components/PlaceMarkers.js | 6 ++ .../src/core-data/PlaceMarker.stories.js | 26 +------- 3 files changed, 7 insertions(+), 89 deletions(-) delete mode 100644 packages/core-data/src/components/PlaceMarker.js diff --git a/packages/core-data/src/components/PlaceMarker.js b/packages/core-data/src/components/PlaceMarker.js deleted file mode 100644 index 086b263f..00000000 --- a/packages/core-data/src/components/PlaceMarker.js +++ /dev/null @@ -1,64 +0,0 @@ -// @flow - -import { LocationMarker } from '@performant-software/geospatial'; -import React, { useCallback, useEffect, useState } from 'react'; - -type Props = { - /** - * The number of miles to buffer the GeoJSON data. (Defaults to 2.) - */ - url: string, - - /** - * The number of miles to buffer the GeoJSON data. (Defaults to 2.) - */ - buffer?: number -}; - -/** - * This component renders a map marker for a given Core Data Place record. - */ -const PlaceMarker = (props: Props) => { - const [place, setPlace] = useState(); - - /** - * Converts the passed data to a feature collection and sets it on the state. - * - * @type {(function(*): void)|*} - */ - const onLoad = useCallback((data) => { - const featureCollection = { - type: 'FeatureCollection', - features: [{ - ...data, - properties: { - ...data.properties, - record_id: data.record_id - } - }] - }; - - setPlace(featureCollection); - }, []); - - /** - * Fetch the place record from the passed URL. - */ - useEffect(() => { - fetch(props.url) - .then((res) => res.json()) - .then(onLoad); - }, [props.url]); - - if (!place) { - return null; - } - - return ( - - ); -}; - -export default PlaceMarker; diff --git a/packages/core-data/src/components/PlaceMarkers.js b/packages/core-data/src/components/PlaceMarkers.js index fc738d4e..3b66d6b1 100644 --- a/packages/core-data/src/components/PlaceMarkers.js +++ b/packages/core-data/src/components/PlaceMarkers.js @@ -13,6 +13,11 @@ import _ from 'underscore'; type Props = { animate?: boolean, + /** + * The number of miles to buffer the GeoJSON data. (Defaults to two.) + */ + buffer?: number, + /** * The URL of the Core Data place record. */ @@ -69,6 +74,7 @@ const PlaceMarkers = (props: Props) => { return ( ); diff --git a/packages/storybook/src/core-data/PlaceMarker.stories.js b/packages/storybook/src/core-data/PlaceMarker.stories.js index 578c8449..9f413b26 100644 --- a/packages/storybook/src/core-data/PlaceMarker.stories.js +++ b/packages/storybook/src/core-data/PlaceMarker.stories.js @@ -78,7 +78,7 @@ export const LargerBuffer = () => ( height: '300px' }} > - @@ -87,27 +87,3 @@ export const LargerBuffer = () => ( ); -export const LargerBuffer = () => ( - - - - - -
- -
-
-
-); From 1569b5e6a4ea82f13a8081c0b30968d5f063dc4d Mon Sep 17 00:00:00 2001 From: Rebecca Black Date: Tue, 12 Mar 2024 12:24:14 -0400 Subject: [PATCH 9/9] updated storybook placemarker to use a place not in the middle of the ocean --- packages/storybook/src/core-data/PlaceMarker.stories.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/storybook/src/core-data/PlaceMarker.stories.js b/packages/storybook/src/core-data/PlaceMarker.stories.js index 9f413b26..a72114ed 100644 --- a/packages/storybook/src/core-data/PlaceMarker.stories.js +++ b/packages/storybook/src/core-data/PlaceMarker.stories.js @@ -30,7 +30,7 @@ export const Default = () => ( > @@ -79,7 +79,9 @@ export const LargerBuffer = () => ( }} >