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-card-flipper

v1.0.1

Published

A React card flipper component.

Downloads

131

Readme

react-card-flipper

Build Status npm version GitHub issues license

A React card flipper component (built with React 16.2.0) that can be triggered by hover or click. Inspired from David Walsh's great tutorial.

Installation

Yarn:

yarn add react-card-flipper

npm:

npm install react-card-flipper --save

Current Browser Support

Initial testing via BrowserStack of a React app that simply renders the card component.

| Browser | Support | Notes | | --------------- | :-----: | ---------------------------- | | Chrome >= 38 | ✅ | | | Edge >= 14 | ✅ | | | Firefox >= 16 | ✅‍ | | | IE 11-10 | ⚠️ | Card flips have no animation | | IE 9.0 | ❌ | No toggling of cards | | Opera >= 30 | ✅ | | | Safari >= 6.2.8 | ✅ | | | Safari 6.0.5 | ⚠️ | Card flips have no animation |

Getting Started

You can import react-card-flipper into your React app. The following is a bare bones example.

Important: The <ReactCardFlipper> component must have two <div> elements, one for the front and one for the back.

import React from "react";
import ReactDOM from "react-dom";
import ReactCardFlipper from "react-card-flipper";

ReactDOM.render(
  <div>
    <ReactCardFlipper>
      <div>The cards front content goes here.</div>
      <div>The cards back content goes here.</div>
    </ReactCardFlipper>
  </div>,
  document.getElementById("root")
);

Props and Options

The ReactCardFlipper component has 4 props it accepts that you can use to adjust how your card behaves.

| Prop / Option | Accepted Prop(s) | Default | Description | | ------------- | :-------------------------: | :-----: | ----------------------------------------------------------------------------------- | | width | String (ex: 300px) | auto | Card width. | | height | String (ex: 600px) | auto | Card height. | | behavior | String (click or hover) | click | If the card should click to flip, or hover to flip. | | levitate | Boolean | false | If the card should "levitate" up on hover. Only applied when behavior is click. |

Example:

render() {
  return(
    <div>
      <ReactCardFlipper width="300px" height="550px" behavior="click" levitate={true}>
        <div>
          <h3>Click me to learn more</h3>
        </div>
        <div>
          <p>You Clicked!</p>
        </div>
      </ReactCardFlipper>
    </div>
  )
}

Styling

Out of the box we provide very little styling aside from core styles like transitions to let you shape the design as you see fit. You can style your cards by passing className's as props. To style the card itself, you want to use innerCardClass, for the card container itself you would use a normal className. You can see a working example here or reference the following code snippet (this example is using react-jss):

<ReactCardFlipper
  width="300px"
  height="400px"
  behavior="click"
  className={classes.root}
  innerCardClass={classes.card}
>
  <div className="text-center">You can click me, go ahead... Try it.</div>
  <div className="text-center">Great job! You win person of the month.</div>
</ReactCardFlipper>

Development

To get started developing on this project, fork or clone the repo. Then run yarn install

Start the development server

yarn start

Starts the development/test server and polls for changes.

Running EsLint

yarn lint

Lints ReactCardFlipper.js and outputs any warnings or errors.

Running Tests

yarn test

Runs EsLint, and builds the test output.

Running Production Build

yarn build

Compiles a new build in the dist/ folder.