/* eslint-disable @typescript-eslint/restrict-template-expressions */ /* eslint-disable @typescript-eslint/no-unsafe-return */ import { divIcon, Point } from 'leaflet' const createSvg = (shape: string, markerColor: string, borderColor: string) => { const svgMap = { circle: '', square: '', star: '', penta: '', } // eslint-disable-next-line security/detect-object-injection return svgMap[shape] } const addIcon = (icon: string) => { switch (icon) { case 'point': return '' case 'calendar': return '' case 'user': return '' case 'fire': return '' case 'tree': return '' case 'music': return '' case 'drum': return '' case 'quest': return '' case 'compass': return '' case 'liebevoll.jetzt': return ' ' case 'group': return '' case 'puzzle': return '' case 'staff-snake': return '' case 'flower': return '' case 'network': return '' default: return '' } } const MarkerIconFactory = (shape: string, color1: string, color2: string, icon: string) => { return divIcon({ html: `${createSvg(shape, color1, color2)}${addIcon(icon)}`, iconAnchor: [17, 40], popupAnchor: [0, -40], iconSize: new Point(40, 46), className: 'leaflet-data-marker', shadowAnchor: [0, 0], }) } export default MarkerIconFactory