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-result-movement-label

v1.3.0

Published

A react component to display label that includes a up or down direction indicator

Downloads

12

Readme

react-npm-result-movement-label

A React component to display result with movement.

npm Version Build Status

Overview

A react component to display label that includes a up or down direction indicator.

let params = {
  'colorMap' : {
    'up' : '#fff521',
    'down' : '#cd0200',
    'zero' : '#d47500',
    'label' : '#ffffff'
  },
  'cssClass': ['bold', 'center']
};
<ResultMovementLabel direction={'up'} params={params}>3%</ResultMovementLabel>

This would be a green (default for up unless overridden by params) label and on the left of the 3% would be an up arrow (http://fortawesome.github.io/Font-Awesome/icon/arrow-circle-up/)

<ResultMovementLabel direction={'down'} params={params}>$2.53</ResultMovementLabel>

This would be a red label (default for down unless overridden by params) label and on the left of the $2.53 would be a down arrow (http://fortawesome.github.io/Font-Awesome/icon/arrow-circle-down/)

<ResultMovementLabel direction={'zero'} params={params}>0%</ResultMovementLabel>

This would be an orange (default for zero unless overridden by params) label and on the left of the 0% would be a dash (http://fortawesome.github.io/Font-Awesome/icon/minus-circle/)

Features

  • Display result with up direction with success color.
  • Display result with down direction with danger color .
  • Display result with zero direct with info color.
  • Display result with any direction with color 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 ResultMovementLabel from 'react-npm-result-movement-label';

class App extends Component {
  render() {
    let params = {
      'colorMap' : {
        'up' : '#fff521',
        'down' : '#cd0200',
        'zero' : '#d47500',
        'label' : '#ffffff'
      },
      'cssClass': ['bold', 'center']
    };
    return(
      <div>
      <h2>Result Movement Label</h2>
      <ResultMovementLabel direction={'up'}>3%</ResultMovementLabel>
      <br />
      <ResultMovementLabel direction={'up'} params={params}>$2.53</ResultMovementLabel>
      <br />
      <ResultMovementLabel direction={'down'}>3%</ResultMovementLabel>
      <br />
      <ResultMovementLabel direction={'down'} params={params}>$2.53</ResultMovementLabel>
      <br />
      <ResultMovementLabel direction={'zero'}>3%</ResultMovementLabel>
      <br />
      <ResultMovementLabel direction={'zero'} params={params}>3%</ResultMovementLabel>
      <br />
      </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-result-movement-label <result-movement-label>

Start Server:

First you have to replace the lib/component/result_movement_label.js to server.js in package.json
cd result-movement-label
npm i
npm start

Run App:

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

Run tests:

cd result-movement-label
npm i
npm test

Developer Notes:

Make sure you configure your editor/IDE to use:

.editorconfig
.eslintrc