GithubHelp home page GithubHelp logo

mohsensami / iran-map Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 4.49 MB

Home Page: https://mrmohsensami.github.io/

HTML 0.25% JavaScript 0.23% CSS 1.73% TypeScript 97.79%
iran-map react iran-map-react

iran-map's Introduction

Iran Map React

The Iran Map React Component is a versatile and customizable map component that displays all cities of Iran. Designed specifically for React.js applications, this package allows developers to easily integrate an interactive map of Iran into their projects.

Features

  • Comprehensive Coverage: Displays all cities in Iran with precise locations.
  • Customization: Easily customize the appearance, including colors, labels, and styles to match your application's design.
  • Interactivity: Supports interactive features such as tooltips, hover effects, and click events to enhance user engagement.
  • Responsive Design: Ensures optimal display and performance across various devices and screen sizes.
  • Lightweight: Minimal dependencies to keep your application fast and responsive.
  • Easy Integration: Simple and straightforward setup to get the map up and running quickly.

Demo

Live Demo

iran-map

Installation

The package can be installed via npm:

npm install iran-map-react

Usage

React Component:

import { IranMap } from 'iran-map-react';

function App() {
    const mapData = {
        ardabil: 16,
        isfahan: 20,
        alborz: 11,
        ilam: 14,
        eastAzerbaijan: 10,
        westAzerbaijan: 20,
        bushehr: 15,
        tehran: 35,
        chaharmahalandBakhtiari: 6,
        southKhorasan: 19,
        razaviKhorasan: 11,
        northKhorasan: 19,
        khuzestan: 12,
        zanjan: 12,
        semnan: 9,
        sistanAndBaluchestan: 3,
        fars: 7,
        qazvin: 25,
        qom: 22,
        kurdistan: 24,
        kerman: 23,
        kohgiluyehAndBoyerAhmad: 20,
        kermanshah: 7,
        golestan: 18,
        gilan: 14,
        lorestan: 7,
        mazandaran: 18,
        markazi: 25,
        hormozgan: 6,
        hamadan: 19,
        yazd: 14,
    };
    const clickProvinceHandler = (province: IProvinceData) => {
        alert(`${province.name} ${province.count}`);
    };
    return (
        <>
            <IranMap
                data={mapData}
                seaBg="#2196f3"
                width={600}
                colorProvincesRange="122, 155, 85" // rgb(122, 155, 85)
                colorSelectedProvince="#e91e63"
                defaultSelectedProvince="tehran"
                clickProvinceHandler={clickProvinceHandler}
            />
        </>
    );
}

export default App;

Props

Here are the props that can be passed to the <IranMap /> component:

Name Type Required Description
data object True An object that has 'Data schema' items as provinces
colorProvincesRange string True it define color range of all provinces which not in defaultSelectedProvince props .
seaBg string False (optional): Customize the color scheme of the Sea.
width number False (optional): Width of the svg map. (default 100% of screen)
defaultSelectedProvince string False (optional): set the default province. (default is none of them)
colorSelectedProvince string False (optional): set the color selected province.
clickProvinceHandler function False you can write a function to get each province objects.

Authors

Contributing

If you want to contribute to this project and make it better, your help is very welcome. Create an issue or submit a pull request.

iran-map's People

Contributors

mohsensami avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.