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

@jonasdoesthings/react-activity-rings

v1.1.2

Published

Apple-inspired Activity Rings for React

Downloads

563

Readme

react-activity-rings

Apple-inspired Activity Rings for React.

npm bundle size (scoped) LICENSE npm version

demo banner gif

Installation

using npm:
npm install @jonasdoesthings/react-activity-rings
using yarn:
yarn add @jonasdoesthings/react-activity-rings

Examples

Storybook Demo: https://jonasdoesthings.github.io/react-activity-rings/

import {ActivityRings} from "@jonasdoesthings/react-activity-rings";

// Basic example with no custom settings
<ActivityRings rings={[
  {filledPercentage: 0.5, color: '#fa0e5a'},
  {filledPercentage: 0.75, color: '#afff02'},
  {filledPercentage: 0.25, color: '#00fff8'},
]} />
// Example with custom settings
<ActivityRings 
  rings={[
    {filledPercentage: 0.1, color: 'rgb(255, 0, 0)'},
    {filledPercentage: 1, color: '#FF0000'},
    {filledPercentage: 0.5, color: '#00fff8'},
  ]} 
  options={{
    initialRadius: 20,
    animationDurationMillis: 1500,
    containerHeight: '10vh',
  }} 
/>

More usage-examples can be found under ./src/components/ActivityRings.stories.tsx.

API

ActivityRings

| Property | Type | Required | Description | |----------|------------------------------|----------|------------------------------------------------------| | rings | ActivityRing[] | yes | An array of ActivityRing objects containing the data | | options | ActivityRingContainerOptions | no | An object containing general settings |

ActivityRing

| Property | Type | Required | Description | |------------------|--------|----------|----------------------------------------------------------------------------------------------------------------------------| | filledPercentage | number | yes | A float between 0 and 1 representing the progress in percent | | color | string | yes | A css-compatible color string i.e. #FF00FF or rgb(0, 255, 0) |

ActivityRingContainerOptions

| Property | Type | Default | Description | |-------------------------|--------|-------------|--------------------------------------------------------------------------------------------------------------------------| | containerHeight | string | 100% | A css-compatible height value of the container | | containerWidth | string | 100% | A css-compatible width value of the container | | paddingBetweenRings | number | 0.75 | The padding between each of the rings | | initialRadius | number | 30 | The radius of the innermost ring | | animationDurationMillis | number | 1000 | The duration of the initial animation in milliseconds (0=no animation) | | animationTimingFunction | string | ease-in-out | A css-compatible animation timing function | | backgroundOpacity | number | 0.4 | A float between 0 and 1 representing the opacity of the background-ring color in percent |

(All fields are optional)

Notes

React Native

This project currently does not work with react native when targeting other platforms than web, due to react native not supporting the used <svg> component and its descendents. If you want to tackle this issue, feel free to fork this project and replace the web svg-component with a react-native supported one.
More Details regarding RN support can be found in this Issue

License

The project is licensed under the MIT license.
Check the LICENSE file, for the full legal-notice.