ConservationMetrics / guardianconnector-views

A Nuxt.js tool that reads data from a SQL database and renders it on different views (map, gallery, alerts dashboard)
MIT License
3 stars 0 forks source link

Add dynamic mapbox legend in `MapLegend` component #31

Closed rudokemper closed 5 months ago

rudokemper commented 5 months ago

Per user feedback, this PR adds an optional map legend which will match a list of provided layer IDs with the mapbox style, and populate an element with the layer id (slightly formatted with regex) and a visual that uses the layer type and color to represent the layer depending on whether it is a type: fill, line, or symbol. The component is added to both of the map and alerts dashboard views, and uses a shared function prepareMapLegendLayers in mapFunctions.ts.

image