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-flippy

v1.1.0

Published

Downloads

6,912

Readme

React-Flippy

React-Flippy allows you to create flipping cards in React projects. It can be used as controlled or uncontrolled component.

Vertical

Horizontal

Live Demo

How to install ?

npm install react-flippy or yarn add react-flippy

How to use ?

import { useRef } from 'react';
import Flippy, { FrontSide, BackSide } from 'react-flippy';
import Flippy, { FrontSide, BackSide } from 'react-flippy';

function Sample() {
  const ref = useRef();
  return (
    <Flippy
      flipOnHover={false} // default false
      flipOnClick={true} // default false
      flipDirection="horizontal" // horizontal or vertical
      ref={ref} // to use toggle method like ref.curret.toggle()
      // if you pass isFlipped prop component will be controlled component.
      // and other props, which will go to div
      style={{ width: '200px', height: '200px' }} /// these are optional style, it is not necessary
  >
    <FrontSide style={{ backgroundColor: '#41669d'}} >
      RICK <br />
      <button onClick={() => { ref.current.toggle(); }}> Toggle via button</button>
    </FrontSide>
    <BackSide style={{ backgroundColor: '#175852'}}>
      ROCKS
    </BackSide>
  </Flippy>
  )
}

API for Components

Flippy

| Prop Name | Description | Values | Default | | :------------: | :------------: | :------------: | :------------: | | flipDirection | Direction of flip effect | horizontal/vertical | horizontal| | flipOnHover | Should card flip on mouse hover | true/false | false | | flipOnClick | Should card click on mouse click/touch | true/false | true | | isFlipped | If you pass isFilipped prop component will be "controlled react component" and flipOnHover, flipOnClick functions will not work. You must handle this functionalities with your own logic. | undefined/true/false | undefined | | ...props | Other props will be passed to container. | | |

Note: Flippy component has a function named "toggle" in its reference.

FrontSide

| Prop Name | Description | Values | Default | | :------------: | :------------: | :------------: | :------------: | | animationDuration | Duration of flip animation, should be used equal with back side for a good view. | number | 600 | | elementType | Dom element type for card | dom element types | div | | ...props | Other props will be passed to card. | | |

BackSide

| Prop Name | Description | Values | Default | | :------------: | :------------: | :------------: | :------------: | | animationDuration | Duration of flip animation, should be used equal with front side for a good view. | number | 600 | | elementType | Dom element type for card | dom element types | div | | ...props | Other props will be passed to card. | | |

Notes

To run sample project, clone the repository and run yarn && yarn start To build project, clone repository and run yarn && yarn build

Changelog

1.0.0 (10 May, 2021)

  • React updated to 17.0.2
  • Component converted to react-hook
  • Dependencies upgraded
  • Fixed bugs

0.1.5 New build system targeting es5 modules.

Credits

Thanks to: https://github.com/fffilo/flipper I have used same methodology for style management.