0.0.22 • Published 6 years ago

@crpt/react-svg-map v0.0.22

Weekly downloads
-
License
MIT
Repository
github
Last release
6 years ago

react-svg-map

Travis npm package Coveralls

SVG Map React component.

Install

npm i --save @crpt/react-svg-map

Usage

import Map, { THEMES } from "@crpt/react-svg-map";

<Map country="russia" selectedId="DFO" theme={THEMES.defaultTheme} />

Map

PropNameDescriptionExample
theme: ObjectMap theme object. Default: THEMES.defaultTheme<Map theme={myCustomTheme} />
country: StringCountry name. Default: 'russia'<Map country="russia" />
region: StringCountry region id. Default: 'RF'<Map region="DFO" />
info: ArrayMap info. Note1.<Map info={[{ percent: 22, region: 'DFO'}]} />
visibleInfo: StringDont hide this info<Map visibleInfo="DFO" />
favorites: IntegerCounter for Flag button<Map favorites={2} />
onZoomInClick: FunctionCallback for ZoomIn control. Receives new scale.<Map onZoomInClick={scale => console.log(scale)} />
onZoomOutClick: FunctionCallback for ZoomOut control. Receives new scale.<Map onZoomOutClick={scale => console.log(scale)} />
onFlagClick: FunctionCallback for Flag control.<Map onFlagClick={() => console.log('Flag clicked')} />
onRegionClick: FunctionCallback on map Region click. Note2<Map onRegionClick={region => console.log(region.id)} />
onInfoClick: FunctionCallback on Info click. Receives region ID<Map onInfoClick={region => console.log(region)>

Note1. info - array of objects

const info = [{percent: 10, region: 'SZFO', owner: 'RF' }];

Note2. onRegionClick receives object

{id: 'SZFO', rect: region.getBoundingClientRect(), target: {id: 'RU-SPE', rect: target.getBoundingClientRect()}}
// id - region id
// rect - region node bounding client rect
// target - clicked region, if region inside District (group of regions).
0.0.22

6 years ago

0.0.21

6 years ago

0.0.20

6 years ago

0.0.19

6 years ago

0.0.18

6 years ago

0.0.17

6 years ago

0.0.16

6 years ago

0.0.15

6 years ago

0.0.14

6 years ago

0.0.13

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago