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

v0.20.0

Published

Display credit cards(port of Card by @jessepollak)

Downloads

905

Readme

React credit card

React port of the display part of Card by @jessepollak

Why?

Card looks amazing on any form, but it interacts with the dom in a more classic javascript interface, which is incompatible with react.

Goals

  • Look like Card.
  • Provide a react interface for displaying credit card information.

How to install

  • npm install react-credit-card
  • Add the build/card.css and build/card-types.css files to your app's stylesheets (This step may be unnecessary in the future)

How to use (Check the test index.cjsx for a better overview)

Card = require('react-credit-card')
React.render(
 <Card 
    cvc = {myForm.props.cvc} 
    name = {myForm.props.name} 
    focused = {'name'}/> // The form turns around when focused is "cvc"
,document.body)

Available props

  • cvc: number(max 4 characters, will cut the rest)(The "/" will be automatically added)
  • name: string (max 2 lines)
  • number: credit card number(max 16 characters, will cut the rest)
  • expiry: number(max 4 characters, will cut the rest)
  • focused: one of the above fields
    • name
    • number
    • expiry
    • cvc (Upon focusing cvc, the form will be rotated until this is changed.)
    • null
  • namePlaceholder: The text displayed as placeholder of name field (default is: "FULL NAME")
  • expiryAfter: The text displayed on the left of the expiry date
  • expiryBefore: The text displayed above the expiry date
  • shinyAfterBack: The text displayed at the back of the card near the shiny thing
  • type: Available in case you need to explicitly specify the card type. In most cases this will be inferred for you as the user fills the form, so you won't need to use it. One of the following:
    • dankort
    • discover
    • mastercard
    • visa
    • amex

Missing features towards the intended goals

  • Images are inlined using base64, Card uses images created with css.

Planned improvements

  • Allow for some way to indicate that a field is invalid, and style appropriately to indicate errors.
  • Add more credit card variations, to the extent that Payment supports.
  • Maybe inline styles according to facebook's new guidelines, for now the styles are in a separate stylesheet.
  • Automated test suite.

Intentional deviations

  • There is no intention to port the form or validation part of Card. This is merely for display.
  • Flat background colors for the various cards.
  • Placeholder symbols are progressively filled while changing the values.

Development

  • Clone the repo
  • Run npm install
  • Run npm start
  • Use test/index.html for testing behaviour and display

It was developed on a local webserver so it doesn't come with any server tools. If someone wants to add a more fleshed out build/testing process (gulp/grunt/webpack) it's very much welcome.

Most of the credit goes to @jessepollak for creating and mantaining Card, I just ported it over.