Skip to content

Commit

Permalink
feat: statblocks now receive monster name as class
Browse files Browse the repository at this point in the history
  • Loading branch information
valentine195 committed Jan 4, 2022
1 parent 707709f commit 9b11b80
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/view/Statblock.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,23 @@
const showMenu = (evt: MouseEvent) => {
menu.showAtMouseEvent(evt);
};
const name =
monster?.name
?.toLowerCase()
.replace(/[^A-Za-z0-9\s]/g, "")
.replace(/\s+/g, "-") ?? "no-name";
</script>

<div class="container" bind:this={container}>
{#if ready}
<div class="obsidian-statblock-plugin statblock">
<div
class:obsidian-statblock-plugin={true}
class:statblock={true}
class={name}
>
{#if monster}
<Bar />
<div class="icons" use:icons on:click={showMenu} />
{#key columns}
<Content {columns} {statblock} {ready} on:save on:export />
{/key}
Expand All @@ -114,6 +123,7 @@
<span>Invalid monster.</span>
{/if}
</div>
<div class="icons" use:icons on:click={showMenu} />
{/if}
</div>

Expand Down

0 comments on commit 9b11b80

Please sign in to comment.