From 44b8065cbe43f0689502fa4669f06b02d1755d86 Mon Sep 17 00:00:00 2001 From: Adam Piontek Date: Sun, 11 Sep 2022 13:46:17 -0400 Subject: [PATCH] progress rendering playing cards: stock display working --- index.html | 13 +++++++------ main.js | 43 +++++++++++++++++++++++++++++++++++++++++-- style.scss | 25 ++++++++++++++++++++++--- 3 files changed, 70 insertions(+), 11 deletions(-) diff --git a/index.html b/index.html index f97d0e7..93efaa2 100644 --- a/index.html +++ b/index.html @@ -92,13 +92,14 @@ > -
- - 2 - - +
+
    + +
- +
diff --git a/main.js b/main.js index 9c3e635..f8514f2 100644 --- a/main.js +++ b/main.js @@ -4,11 +4,50 @@ import Alpine from "alpinejs"; // import 'bootstrap/dist/js/bootstrap' Alpine.store('global', { - cardsToSolve: [] + cardsToSolve: Array(52).fill(0) }) Alpine.data("playingCardsPreview", () => ({ - testing: true + rankText: { + 'A': 'Ace', + '2': 'Two', + '3': 'Three', + '4': 'Four', + '5': 'Five', + '6': 'Six', + '7': 'Seven', + '8': 'Eight', + '9': 'Nine', + 'T': 'Ten', + 'J': 'Jack', + 'Q': 'Queen', + 'K': 'King' + }, + suitText: { + 'C': 'Clubs', + 'D': 'Diamonds', + 'H': 'Hearts', + 'S': 'Spades' + }, + rankSlug(rank) { + return `rank-${rank === 'T' ? '10' : rank}` + }, + suitSlug: { + 'C': 'clubs', + 'D': 'diams', + 'H': 'hearts', + 'S': 'spades' + }, + cardHtml(card, index) { + if (card === '0' || card === 0) { + return `` + } else { + return `` + } + }, + stockCard(index) { + return 500 - (10 * index) + } })); Alpine.data("cardsInputForm", () => ({ diff --git a/style.scss b/style.scss index e918dc1..55c1893 100644 --- a/style.scss +++ b/style.scss @@ -1,12 +1,31 @@ @import "../node_modules/bootstrap/scss/bootstrap"; +abbr[title] { + border-bottom: none !important; + cursor: inherit !important; + text-decoration: none !important; +} + .playingCards { .card { - box-shadow: .1em .1em .3em #999 !important; + box-shadow: .05em .05em .1em #888 !important; + border-color: #aaa !important; + border-radius: 0.2em !important; .suit { &::after { - line-height: .8 !important; + margin-top: -.9em !important; + font-size: 0.9em !important; } } + .suit-b { + position: absolute; + right: 4px; + bottom: 18px; + } + .rank-b { + position: absolute; + right: 4px; + bottom: -1px; + } } -} \ No newline at end of file +}