0.1.0 • Published 2 months ago

algeria-map-ts v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

algeria-map-ts

A React component that displays an interactive map of Algeria including all 58 wilayas.

Demo

You can see a live demo of the component in action at the following link:

Live Demo

Installation

This component is available via npm. To install, run the following command:

npm

npm install --save algeria-map-ts

yarn

yarn add algeria-map-ts

Usage

The component is straightforward to use. First, import it, and then use it as a regular React component:

Example:

import { Map } from "react-algeria-map-ts";

<Map
  color="#55E6C1"
  HoverColor="#58B19F"
  stroke="#fff"
  hoverStroke="#218c74"
  height="400px"
  width="400px"
  data={data}
  onWilayaClick={(wilaya, data) => console.log(wilaya, data)}
/>;

Props

PropTypeDescription
colorstringSet the default color of the wilayas in the map
HoverColorstringSet the color of the hovered wilaya
strokestringSet the color of the borders of the wilayas
hoverStrokestringSet the color of the borders of the hovered wilaya
heightstringSet the occupied height by the map
widthstringSet the occupied width by the map
dataobjectSets the data to show in hover or click actions on each wilaya. The keys are fixed, and the values of the keys value and color if u didn't give a color to a wilaya then the default color will be applied.
onWilayaClickfunction(key: string, value: string | number | boolean): voidThe callback function to execute when the wilaya is being clicked

Data Prop

The data prop is an object where each key is the name of the wilaya, and its value is an object with value and color properties. The value represents the data to display, and color is the color of the wilaya.

Exmaple:

const data = {
  Adrar: { value: 120, color: "#fff9eb" },
  Alger: { value: 60, color: "#ebf9ee" },
  // ... other wilayas
};

Feel free to customize the data object to include the specific values and colors you want for each wilaya.

TypeScript Support

The component is now fully compatible with TypeScript. Benefit from type checking and improved developer experience.

Contributing

We warmly welcome contributions from everyone, regardless of their level of expertise.

If you're making a major change, it's a good idea to create an issue first to discuss it.

To start contributing, follow these steps:

  1. Fork the repo.
  2. Clone your fork: git clone https://github.com/Ad019El/algeria-map-ts.git
  3. Create your feature branch: git checkout -b my-new-feature
  4. Make your changes and commit them: git commit -am 'Add some feature'
  5. Push to the branch: git push origin my-new-feature
  6. Submit a pull request.

We'll review your pull request as soon as we can. Thanks for your contribution!

Credits

This project is an enhancement of the original react-algeria-map.

0.1.0

2 months ago

0.0.9

4 months ago

0.0.8

4 months ago

0.0.7

4 months ago

0.0.6

4 months ago

0.0.5

4 months ago

0.0.4

4 months ago

0.0.3

4 months ago

0.0.2

4 months ago

0.0.1

4 months ago