MapComplete/src/UI/Reviews/StarsBarIcon.svelte

17 lines
546 B
Svelte
Raw Normal View History

2023-09-28 04:02:42 +02:00
<script lang="ts">
2023-09-28 23:50:27 +02:00
import { Store } from "../../Logic/UIEventSource"
import StarsBar from "./StarsBar.svelte"
import { ariaLabel } from "../../Utils/ariaLabel"
import Translations from "../i18n/Translations"
2023-09-28 04:02:42 +02:00
2023-09-28 23:50:27 +02:00
export let score: Store<number>
let scoreRounded = score.mapD(count => Math.round(count / 10) / 2)
2023-09-28 04:02:42 +02:00
</script>
{#if $score !== undefined && $score !== null}
<div tabindex="0"
use:ariaLabel={Translations.t.reviews.averageRating.Subs({n: $scoreRounded})}>
<StarsBar readonly={true} score={$score} />
</div>
2023-09-28 04:02:42 +02:00
{/if}