import { useMap } from "react-leaflet"; import { useEffect } from "react"; import L from "leaflet"; const Legend = () => { const map = useMap(); useEffect(() => { if (map) { // @ts-ignore const legend = L.control({ position: "bottomleft" }); legend.onAdd = () => { const div = L.DomUtil.create("div", "map-legend"); div.setAttribute( "style", "background: white; color: black; border: 2px solid grey; border-radius: 6px; padding: 10px;" ); div.innerHTML = `