npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

algeria-map-ts

v0.1.5

Published

A react component that displays an interactive map of Algeria including all 58 wilayas with custom colors for each wilayas.

Downloads

108

Readme

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

| Prop | Type | Description | | ------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | color | string | Set the default color of the wilayas in the map | | HoverColor | string | Set the color of the hovered wilaya | | stroke | string | Set the color of the borders of the wilayas | | hoverStroke | string | Set the color of the borders of the hovered wilaya | | height | string | Set the occupied height by the map | | width | string | Set the occupied width by the map | | data | object | Sets 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. | | onWilayaClick | function(key: string, value: string | number | boolean): void | The 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.