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-progressive-entrance

v0.4.0

Published

React components to create nice-looking progressive entrance

Downloads

5

Readme

react-progressive-entrance

React components to create nice-looking progressive entrance

In comparison with other react libraries like ReactCSSTransitionGroup, React-progressive-entrance uses new feature of React 16.6: context. It means that you can animate any descending child component of the group and not only the first level child. It allows you create sophisticated animated entrances more easily.

Getting started

Before installing it, notice that this library only works with React 16.3+ because it uses the API of context.

# with npm
$ npm install react-progressive-entrance --save
$ yarn add react-progressive-entrance

How to use it

Like some other animation libraries in React, react-progressive-entrance is based on 2 kind of components: a parent item and children items.

import { AnimatedGroup, AnimatedItem } from 'react-progressive-entrance'

export default = () => (
  <div>
    <AnimatedGroup animation="fade">
      <AnimatedItem animationIndex="1">
        <h1>Title</h1>
      </AnimatedItem>

      <div>
        <!--
          -- Thanks to the context API the children items {'don\'t'} need to be direct children,
          -- They can be in other html elements
         -->
        <AnimatedItem animationIndex="2">
          <span>Item 1</span> <!-- each content must inside a html element -->
        </AnimatedItem>

        <AnimatedItem animationIndex="3" animation="slide-left"><!--you can override the animation -->
          <span>Item 1</span>
        </AnimatedItem>

        <!-- if you put several html elements in an AnimatedItem, it will automatically
          -- create AnimatedItem for each element
          -->
        <AnimatedItem animationIndex="3" >
          <span>Item 1</span>
          <span>Item 2</span>
        </AnimatedItem>
        <!-- is equivalent to -->
        <AnimatedItem animationIndex="3" >
          <span>Item 1</span>
        </AnimatedItem>
        <AnimatedItem animationIndex="4" >
          <span>Item 2</span>
        </AnimatedItem>
      </div>
    </AnimatedGroup>
  </div>
)

You also need to define your class in your stylesheet

/* for fade animation */
.fade-enter { /* before animation */
  opacity: 0;
}

.fade-enter-active { /* after animation */
  opacity: 1;
  transition: opacity 250ms ease-in;
}

/* for slide from left animation */
.slide-left-enter { /* before animation */
  transform: translateX(-2000px);
}

.slide-left-enter-active { /* after animation */
  transform: translateX(0);
  transition: transform 700ms ease-out;
}

/* for slide from right animation */
.slide-right-enter { /* before animtion */
  transform: translateX(2000px);
}

.slide-right-enter-active { /* after animation */
  transform: translateX(0);
  transition: transform 700ms ease-out;
}

You can of course add your own animations and refers to it thanks to the property animation.

API

AnimatedGroup

| Property | Type | Default value | Description | |-----------|--------|---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | animation | string | fade | The animation when the components appear. Only fade, slide-left and slide-right natively exists but you can add your own animations. | | interval | number | 200 | It is the minimum timing between 2 animations | | pitch | number | 1 | After each interval of time, the threshold of the AnimatedGroup is incremented by the pitch. Most of the time, this value doesn't need to be changed. However, it may useful when you want to reinsert new items between existing ones. | | trigger | string | mount | Define the way the animation will be triggered. With the value 'mount', the animation will started as soon as the AnimatedGroup is mounted. Otherwise, you can manually trigger the animation using the function play of the AnimatedGroup. |

AnimatedItem

| Property | Type | Default value | Description | |----------------|--------|---------------|-----------------------------------------------------------------------------------------------------| | animation | string | fade | This value overloads value defined by AnimatedGroup only for the current item if it is defined. | | index | number/string | 'auto' | The iteration value of the AnimatedGroup that will trigger the animation of the current item. If set to 'auto', the nodes will be displayed according to the order they are mounted into the DOM. |

Changelog

Version 0.4.0

  • maxIndex is now set up automatically
  • create a 'auto' value for index
  • rename animationIndex for index

Version 0.3.0

  • Several nodes children of a AnimatedItem are now displayed progressively

Version 0.2.0

  • Release of the first version