Skip to content

Latest commit

 

History

History
63 lines (40 loc) · 1.07 KB

README.md

File metadata and controls

63 lines (40 loc) · 1.07 KB

Cards

A React library of Card components and basic functionality.

Installation

npm install --save @theresamclaird/cards

Usage

import { Card, Back } from '@theresamclaird/cards';

Render a card

<Card color="#000" suit="spades" label="A" pip="♠" value={1} />;

Render a card back

<Back />;

Generate a (default) deck of cards

import { getDeck } from '@theresamclaird/cards';

const deck = getDeck();

Generate a Shoe

import { getShoe } from '@theresamclaird/cards';

const shoe = getShoe(6); // Pass the number of decks needed for the shoe.

Shuffle & Cut

import { getDeck, shuffle } from '@theresamclaird/cards';

const deck = getDeck();
const shuffledCards = shuffle(deck);
const cutCards = cut(shuffledCards);

Component Playback

To run Storybook and see rendered Card components, run:

npm run storybook

This runs Storybook.
Open http://localhost:6006 to view it in your browser.