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

react-npm-circular-status-indicator

v1.11.0

Published

A react component to display an analysis or observation result in a coloured Circular Percentage Indicator

Downloads

19

Readme

react-npm-circular-status-indicator

A React component to display coloured animated circular progress bar with percentage variations.

npm Version Build Status

Overview

A minimal usage will just display coloured circular percentage bar with animation.

let percentage = 75
<CircularStatusIndicator>{percentage}</CircularStatusIndicator>;

The color of the bar by default would be based on the range of the percentage, so:

| Range | Default | ------------- |---------- | 0-25 | red | 26-50 | yellow | 51-75 | blue | 76-100 | green

This might have a default height/width of 100px

But User can override:

let percentage = 75
<CircularStatusIndicator radius={50}>{percentage}</CircularStatusIndicator>;

Other options can be passed in as inverted like so:

let percentage = 75
<CircularStatusIndicator inverted={true}>{percentage}</CircularStatusIndicator>;

In this case, the colors would be reversed;

| Range | Default | ------------- |---------- | 0-25 | green | 26-50 | blue | 51-75 | yellow | 76-100 | red

final possibility is where the colour of the bar is passed in as a prop:

<CircularStatusIndicator colour={'#FFC000'}>75</CircularStatusIndicator>

The only additional prop needed would be a text label, 50% font size of the percentage, placed above it and centered of course

<CircularStatusIndicator radius='{200}' textLabel={'Hello!'}>75</CircularStatusIndicator>

Features

  • Display circular percentage bar.
  • Dispay default coloured bar according to prercentage.
  • Dispay inverted coloured bar according to prercentage.
  • Display colured percentage bar according to color pass through params.
  • Display colured percentage bar according to radius passed through params .
  • Display percentage label inside the circle with result label passed through params
  • Runs in the browser and Node.js.
  • Built on standards.

Example

import React,{Component} from 'react';
import ReactDOM from 'react-dom';
import CircularStatusIndicator from 'react-npm-circular-status-indicator';

class App extends Component {
  render() {
    return(
      <div>
      <h2>Circular Status Indicator</h2>
      <CircularStatusIndicator textLabel={'Default'}>80</CircularStatusIndicator>
      <CircularStatusIndicator inverted={true} textLabel={'Inverted'}>80</CircularStatusIndicator>
      <CircularStatusIndicator colour={'#04c3ff'} textLabel={'Colour'}>80</CircularStatusIndicator>
      <CircularStatusIndicator radius={200} textLabel={'Radius'}>70</CircularStatusIndicator>
      <CircularStatusIndicator radius={50}>40</CircularStatusIndicator>
      </div>
    );
  }
}

ReactDOM.render(<App />,document.querySelector('.container'));

Technology Stack:

  • react
  • mocha

Usage:

Clone the repo as a new project:

git clone https://github.com/lobdev/react-npm-circular-status-indicator <circular-status-indicator>

Start Server:

First you have to replace the lib/component/circular_status_indicator.js to server.js in package.json
cd circular-status-indicator
npm i
npm start

Run App:

npm start command automatically initiate browser at 3000 port
http:://localhost:3000

Run tests:

cd circular-status-indicator
npm i
npm test

Developer Notes:

Make sure you configure your editor/IDE to use:

.editorconfig
.eslintrc