1.0.23 • Published 9 months ago

playing-cards-react v1.0.23

Weekly downloads
-
License
-
Repository
-
Last release
9 months ago

playing-cards-react

This package provides simple to use playing card components for React projects. The interface was designed so that usage mimics how card are described colloquially.

Installation: npm install playing-cards-react

Usage

To return a JSX component containing the card, utilize Card.${rank}.of(suitName).

Card.ten.of("Diamonds")

Card also has utility functions for each suit, if you don't care to specify the suit:

Card.jack.ofSpades()

These card components will fill the height of their container, and auto-scale their width with the appropriate aspect ratio.

This package also provides a simple way to render a hand of playing cards -- the CardCollection component. It requires one prop -- a list of CardData objects. This component will expand to fill the full height and width of its parent container.

Example:

<CardCollection cardList={[
  {
    rank: "two",
    suit: "Spades",
  },
  {
    rank: "five",
    suit: "Hearts",
  }
]}

Future Updates

Future updates will provide onClick() handlers for the cards, as well as functions to manage the inventory of a CardCollection.

1.0.23

9 months ago

1.0.22

9 months ago

1.0.21

9 months ago

1.0.20

9 months ago

1.0.19

9 months ago

1.0.18

9 months ago

1.0.17

9 months ago

1.0.16

9 months ago

1.0.15

9 months ago

1.0.14

9 months ago

1.0.13

9 months ago

1.0.12

9 months ago

1.0.11

9 months ago

1.0.10

9 months ago

1.0.9

9 months ago

1.0.8

9 months ago

1.0.7

9 months ago

1.0.6

9 months ago

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago