import { TileLayer, MapContainer, Marker } from "react-leaflet"; import "leaflet/dist/leaflet.css"; import * as React from "react"; import MarkerIconFactory from './Utils/MarkerIconFactory'; import MarkerClusterGroup from 'react-leaflet-markercluster'; import MarkerPopup, { IMapItem, ITag } from "./Components/Map/MarkerPopup"; import "./styles.scss" export interface IMapProps { height: string, width: string, center: number[], zoom: number, places?: IMapItem[], events?: IMapItem[], tags?: ITag[], } const UtopiaMap = (props: IMapProps) => { let tagMap = new Map(props.tags?.map(key => [key.id, key])); const getTags = (item: IMapItem) => { let tags: ITag[] = []; item.tags && item.tags.forEach(element => { if (tagMap.has(element)) { tags.push(tagMap.get(element)!) }; }); return tags; } return ( {props.places && props.places.map((place: IMapItem) => { let tags = getTags(place); let color1 = "#555"; let color2 = "RGBA(35, 31, 32, 0.2)"; if (tags[0]) { color1 = tags[0].color; } if (tags[1]) { color2 = tags[1].color; } return ( ) } ) } {props.events && (props.events).map((event: IMapItem) => ( )) } ); } export default UtopiaMap;