Skip to content

theresamclaird/cards

Repository files navigation

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published