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-animated-weather

v4.0.1

Published

Animated weather component for React inspired by Skycons http://darkskyapp.github.io/skycons/

Downloads

5,670

Readme

React Animated Weather

Animated weather component for React inspired by Skycons http://darkskyapp.github.io/skycons/ :sunny:

Build Status npm npm

React Animated Weather

Installation

React Animated Weather is available as a node package. Get it via yarn or npm:

yarn add react-animated-weather

-or-

npm install react-animated-weather

If using npm < 5, you might want to save to your package.json:

npm install --save react-animated-weather

react-animated-weather also has peer dependencies on react, react-dom and prop-types.

Usage

Import the ReactAnimatedWeather component:

import ReactAnimatedWeather from 'react-animated-weather';

Sample usage:

import React from 'react';
import ReactAnimatedWeather from 'react-animated-weather';

const defaults = {
  icon: 'CLEAR_DAY',
  color: 'goldenrod',
  size: 512,
  animate: true
};

const App = () => (
  <ReactAnimatedWeather
    icon={defaults.icon}
    color={defaults.color}
    size={defaults.size}
    animate={defaults.animate}
  />
);

export default App;

Props:

  • icon: Takes a string to display the corresponding icon out of the following

    • CLEAR_DAY
    • CLEAR_NIGHT
    • PARTLY_CLOUDY_DAY
    • PARTLY_CLOUDY_NIGHT
    • CLOUDY
    • RAIN
    • SLEET
    • SNOW
    • WIND
    • FOG
  • color: Pass a color value or hex code to color the weather component, if not passed, by default black is picked

  • size: Pass a number to size the weather component in pixels, if not passed, by default 64 is set as the size

  • animate: Pass a boolean value, if true (by default), the weather component will animate and if false, the weather component will remain static without any animation

Here are the default props used by ReactAnimatedWeather component:

ReactAnimatedWeather.defaultProps = {
  animate: true,
  size: 64,
  color: 'black'
};

ReactAnimatedWeather.propTypes = {
  icon: PropTypes.oneOf([
    'CLEAR_DAY',
    'CLEAR_NIGHT',
    'PARTLY_CLOUDY_DAY',
    'PARTLY_CLOUDY_NIGHT',
    'CLOUDY',
    'RAIN',
    'SLEET',
    'SNOW',
    'WIND',
    'FOG'
  ]).isRequired,
  animate: PropTypes.bool,
  size: PropTypes.number,
  color: PropTypes.string
};

Development

I've added a storybook for the component since it has a small number of props and the storybook interface is quite good for testing out the component. You can fire up the storybook by running:

yarn storybook

-or-

npm run storybook

Motivation

I got inspired to write this component from darkskyapp's Skycons. It makes use of the <canvas> element to render beautiful animated weather components.

Working with <canvas> in virtual DOM is a bit tricky. ReactAnimatedWeather uses a ref to refer to the DOM holding the <canvas> element and render the weather component on componentDidMount().

If you've found any bugs, please open an issue on github.