reorganize things and add some cards components

This commit is contained in:
RussellChamp committed 2021-08-14 21:37:30 -04:00
1 parent 51948299fa
commit 40adfd6eaa
29 files changed
+664 -487

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
<script lang="ts">
import { Button } from "sveltestrap";
import { format as formatDate } from "date-fns";
import DungeonCard from "./DungeonCard.svelte";
import { Dungeon, rollDungeon } from "../rollers/dungeons";
export let rollResults: { dungeon: Dungeon; timestamp: string }[] = [];
function roll(event: Event) {
let dungeon = rollDungeon();
rollResults = [{ dungeon, timestamp: formatDate(new Date(), "P kk:mm:ss") }, ...rollResults];
}
</script>
<main>
<span class="btn">
<Button color="primary" on:click={roll}>Roll Dungeon</Button>
</span>
{#each rollResults as { dungeon, timestamp }}
<DungeonCard {dungeon} {timestamp} />
{/each}
</main>
<style>
main {
text-align: left;
}
.btn {
text-align: center;
}
</style>