1.0.0 • Published 4 years ago

react-istanbul-map v1.0.0

Weekly downloads
5
License
MIT
Repository
github
Last release
4 years ago

React Istanbul Map

An Istanbul map implemented on React.

demo

Installation

$ npm install react-istanbul-map

or

$ yarn add react-istanbul-map

Usage

Import the package in your component:

import IstanbulMap from 'react-istanbul-map'

Using with default props

<IstanbulMap />

NOTE: Make sure that you imported Bootstrap CSS file as below:

import 'bootstrap/dist/css/bootstrap.min.css'

Styling

NameDescriptionDefault
mapColorThe color of districts without hover#708090
hoverColorThe color of districts with hover#F9D342
<IstanbulMap
  mapColor="#colorCode"
  hoverColor="#colorCode"
/>

Custom Data

You can use your data in the format as below:

const customData = [
  {
    name: "TUZLA",
    content: "Nüfus: 267.400 (2019)"
  },
  {
    name: "PENDİK",
    content: "Nüfus: 711.894 (2019)"
  },
  ...
];

Use your custom data in data prop:

<IstanbulMap
  data={customData}
/>

app-demo NOTE: If you don't provide any data, only the name of each district will be shown by default.

API

props

NameDescriptionDefault
isHoverableIf it's hoverable, the district names with/without additional content will be showntrue
mapWidthThe width of viewport for SVG1000px
mapHeightThe height of viewport for SVG700px
viewBoxThe viewbox for SVG70 25 80 60

License

This project is licensed under MIT (https://opensource.org/licenses/MIT)