Skip to content

Commit

Permalink
fix(stats): small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
DuckySoLucky committed Dec 15, 2024
1 parent dabb0fd commit c751f25
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
8 changes: 7 additions & 1 deletion src/lib/components/Bonus.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,19 @@
export { classNames as class };
const statsData = Object.entries(stats);
function formatValue(value: string) {
return parseFloat(value)
.toFixed(2)
.replace(/\.?0+$/, "");
}
</script>

<p class={cn("space-x-0.5 font-bold capitalize leading-6 text-text/60", classNames)}>
<span>{title}</span>
{#each statsData as [key, value], index}
<span class={STATS_DATA[key].color}>
{value}{STATS_DATA[key].suffix}
{formatValue(value as string)}{STATS_DATA[key].suffix}
{STATS_DATA[key].nameTiny}
</span>
{#if statsData.length - 1 !== index}
Expand Down
12 changes: 8 additions & 4 deletions src/lib/sections/stats/Armor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@
</script>

<Items title="Armor">
<p slot="text" class="space-x-0.5 font-bold capitalize leading-6 text-text/60">
<span>Set:</span>
<span class={cn(getRarityClass(armor.set_rarity ?? "", "text"))}>{armor.set_name}</span>
</p>
<div slot="text">
{#if armor.set_name}
<p class="space-x-0.5 font-bold capitalize leading-6 text-text/60">
<span>Set:</span>
<span class={cn(getRarityClass(armor.set_rarity ?? "", "text"))}>{armor.set_name}</span>
</p>
{/if}
</div>
{#each armor.armor as piece}
<Item {piece} />
{/each}
Expand Down

0 comments on commit c751f25

Please sign in to comment.