diff options
Diffstat (limited to 'frontend/src/lib/statistics')
-rw-r--r-- | frontend/src/lib/statistics/Stat.svelte | 12 | ||||
-rw-r--r-- | frontend/src/lib/statistics/StatGroup.svelte | 6 |
2 files changed, 12 insertions, 6 deletions
diff --git a/frontend/src/lib/statistics/Stat.svelte b/frontend/src/lib/statistics/Stat.svelte index c657526..7e03e09 100644 --- a/frontend/src/lib/statistics/Stat.svelte +++ b/frontend/src/lib/statistics/Stat.svelte @@ -1,8 +1,12 @@ <script lang="ts"> - export let title: string; - export let value: number; - export let precision = 0; - export let unit = ''; + interface Props { + title: string; + value: number; + precision?: number; + unit?: string; + } + + let { title, value, precision = 0, unit = '' }: Props = $props(); function format(value: number) { if (Number.isNaN(value) || !Number.isFinite(value)) { diff --git a/frontend/src/lib/statistics/StatGroup.svelte b/frontend/src/lib/statistics/StatGroup.svelte index e1b97da..e84c555 100644 --- a/frontend/src/lib/statistics/StatGroup.svelte +++ b/frontend/src/lib/statistics/StatGroup.svelte @@ -1,5 +1,7 @@ <script lang="ts"> - export let title; + import type { Snippet } from 'svelte'; + + let { title, children }: { title: string; children?: Snippet } = $props(); </script> <section @@ -7,6 +9,6 @@ > <h2 class="text-2xl">{title}</h2> <div class="flex flex-row flex-wrap gap-10"> - <slot /> + {@render children?.()} </div> </section> |