svgmap-core
Version:
Core app for rendering SVG Maps in React based on the given drawpath
2 lines (1 loc) • 688 B
JavaScript
import e from"react";const t="inherit",o="#ffffff",s="#000000",l="0.5",r="#303030",i=({districtCodes:i,drawPath:n,viewBox:a="150 42 800 793",className:c="svgmap",size:d,mapColor:m,strokeColor:f,strokeWidth:v,hoverColor:p,onClick:h})=>{const k={width:d||t,fill:m||o,stroke:f||s,strokeWidth:v||l};return e.createElement("div",{className:c,style:k},e.createElement("svg",{version:"1.1",id:"svg2",x:"0px",y:"0px",viewBox:a},i.map((t=>e.createElement("path",{key:t,onClick:()=>h(t),onMouseEnter:()=>(e=>{const t=document.getElementById(e);t&&(t.style.fill=p||r)})(t),onMouseLeave:()=>(e=>{const t=document.getElementById(e);t&&(t.style.fill=m||o)})(t),id:t,d:n[t]})))))};export{i as default};