random fixes

This commit is contained in:
Hamcha 2024-10-31 23:59:00 +01:00
parent 1e5529838d
commit afc4338097
Signed by: hamcha
GPG key ID: 1669C533B8CF6D89
2 changed files with 18 additions and 4 deletions

View file

@ -47,6 +47,7 @@ img.bg {
&.reveal { &.reveal {
filter: none; filter: none;
opacity: 0.6;
} }
} }
@ -88,7 +89,11 @@ h2 {
padding: 2rem; padding: 2rem;
background-color: rgba(2, 9, 23, 0.8); background-color: rgba(2, 9, 23, 0.8);
border-radius: 1rem; border-radius: 1rem;
word-spacing: 10px;
&.encoded {
word-spacing: 10px;
}
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -115,7 +120,7 @@ h2 {
height: 100vh; height: 100vh;
display: grid; display: grid;
grid-template-columns: 1fr; grid-template-columns: 1fr;
grid-template-rows: 1fr 1fr 100px; grid-template-rows: 1fr 1fr;
h1 { h1 {
margin-bottom: 0; margin-bottom: 0;
@ -124,12 +129,18 @@ h2 {
} }
.actions { .actions {
position: fixed;
bottom: 0;
height: 100px;
justify-self: center; justify-self: center;
align-self: center; align-self: center;
gap: 0.5rem;
button { button {
font-size: 1.2rem; font-size: 1.2rem;
padding: 1rem 0.8rem; padding: 1rem 0.8rem;
border-radius: 1rem;
background-color: rgba(255, 255, 255, 0.6);
} }
} }
} }

View file

@ -28,7 +28,7 @@ const render = (format: Format, reveal = false, card_id?: number) => {
const index = card_id || Math.floor(Math.random() * cards.length); const index = card_id || Math.floor(Math.random() * cards.length);
const randomCard = cards[index]; const randomCard = cards[index];
const cardImage = $el('img', { const cardImage = $el('img', {
className: `bg ${format}`, className: `bg ${reveal ? 'reveal' : ''}`,
src: scryfallURL(randomCard.id), src: scryfallURL(randomCard.id),
}); });
const translate = (text: string) => { const translate = (text: string) => {
@ -60,7 +60,10 @@ const render = (format: Format, reveal = false, card_id?: number) => {
: '', : '',
), ),
$el( $el(
'article.cardbox', 'article',
{
className: `cardbox ${reveal ? '' : 'encoded'}`,
},
$el('h2', translate(randomCard.type.replace(' ', ''))), $el('h2', translate(randomCard.type.replace(' ', ''))),
$el('p.rules', translate(randomCard.text)), $el('p.rules', translate(randomCard.text)),
randomCard.flavorText randomCard.flavorText