performant-software / react-components

A library of shared React components
https://performant-software.github.io/react-components/
MIT License
1 stars 1 forks source link

Minimal 'CoreDataPlace' Widget Example #247

Closed rsimon closed 6 months ago

rsimon commented 7 months ago

In this PR

This PR adds a new component to the geospatial package: <CoreDataPlace>. This component retrieves a Place resource from the Core Data API, and renders it's GeoJSON geometry on a mapLibre map.

CoreDataPlace takes the following input props:

Note: for now, this component is minimal, and supposed to serve as an example only!

Bildschirmfoto 2024-01-27 um 09 13 47
rsimon commented 7 months ago

I made a few amendments:

I made a few tweaks to adapt the code style. I also ran yarn flow and that didn't report any errors. But not sure if I'm using it wrong...

Regarding the interface vs. type issue: that definitely was one of the issues. I'm one step further, but it's still not working. Storybook complains about @peripleo not exporting Feature and FeatureCollection for example. Both of which are interfaces. (In fact the log output lists all of the exports - and none of the interfaces are there.)

Is there anything we can change about the configuration to make Storybook recognize interfaces? Otherwise, I'll change all the interfaces defined in @peripleo to types.

rsimon commented 7 months ago

(Partial) success at last! Thanks for the hints - yes, those deps should have been under dependencies not devDependencies of course. Sorry for the mishap. (I shouldn't have copy-and-pasted those into the package.json after all...)

After that, the component showed up in storybook. A few things were still missing, which I added:

Bildschirmfoto 2024-01-31 um 07 53 24

I also added the // @flow directive. This did seem to change at least something. (The Flow status indicator in VS code now shows that the file is begin covered.) But otherwise had no effect on syntax highlighting. Still getting errors shown about TS not being allowed in .js files. I'll enquire with Camden.

dleadbetter commented 6 months ago

Closing in favor of #252.