mirror of
https://github.com/RussellChamp/tpw-roller.git
synced 2026-10-28 00:22:36 +00:00
reorganize things and add some cards components
This commit is contained in:
1 parent
51948299fa
commit
40adfd6eaa
29 files changed
+664
-487
No files matched your search
@@ -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>
|
||||
Reference in new issue
Block a user