VEuPathDB / web-components

Library of React components for plotting data
Apache License 2.0
1 stars 0 forks source link

Full screen map: refactor donut and chart markers to allow them to also be rendered outside Leaflet #416

Closed bobular closed 1 year ago

bobular commented 1 year ago

QA notes: No QA possible in EDA yet. This is just groundwork. There are storybook stories for the donut and chart markers.

In a donut marker story, I have tried accessing markers[0].props.icon which ought to contain a Leaflet.divIcon that should have a createIcon method. But the icon prop is null when I try to access it. So I don't recommend trying that route any further.

The cleaner solution anyway would be to factor out the svgHTML generation in DonutMarker.tsx and ChartMarker.tsx into helper functions (one takes DonutMarkerProps, the other takes ChartMarkerProps as arguments - excluding the onClick prop, which seems to be unused anyway [should we remove this?]).

Then create two new Leaflet-free components: DonutMarkerIcon and ChartMarkerIcon that simply render a div with the SVG icon in it (using the new helper functions of course). The new components take the same props as the regular markers (especially if we get rid of the onClick).