import * as L from 'leaflet'; const createSvg = (shape:string, markerColor:string, borderColor:string) => { const svgMap = { circle: '', square: '', star: '', penta: '' }; return svgMap[shape]; } const addIcon = (icon:string) => { switch(icon) { case "circle-solid": return ''; break; case "calendar-days-solid": return ''; break; default: return ""; } } const MarkerIconFactory = (shape:string, color1:string, color2:string, icon:string) => { return L.divIcon({ html: `${createSvg(shape, color1, color2)}${addIcon(icon)}`, iconAnchor: [17,40], popupAnchor: [0,-40], iconSize: new L.Point(40, 46), className: "leaflet-data-marker", shadowAnchor: [0, 0] }); } export default MarkerIconFactory ;