billstclair / elm-cards-view / CardsView

Turn a playing card into an Svg instance.

Convert a Card to Svg

This is likely all that you'll use from this module.

cardToSvg : Cards.Card -> Basics.Int -> CardDescription msg

Convert a Card and a height into Svg.

cardToClickableSvg : msg -> Cards.Card -> Basics.Int -> CardDescription msg

Convert a Card and a height into a clickable Svg, which invokes msg when clicked.

Types


type alias CardDescription msg =
{ card : Cards.Card
, size : Size
, svg : Svg msg 
}

Information about one card.


type alias Size =
{ width : Basics.Int
, height : Basics.Int 
}

Width and height.


type alias CardTextDescription =
{ card : Cards.Card
, size : Size
, svg : String 
}

Low-level information about a card.

Utilities

cardToPrettyString : Cards.Card -> String

Turn a Card into a pretty string.

e.g. cardToPretyString(Card Spades Queen) -> "Queen of Spades"

cardToString : Cards.Card -> String

Turn a Card into a string.

stringToCard : String -> Result String Cards.Card

Parse a String into a Card.

suitToString : Cards.Suit -> String

Turn a Suit into a string.

faceToString : Cards.Face -> String

Convert a Face to a String.