MapComplete/src/UI/Reviews/StarsBar.svelte

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
499 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 StarElement from "./StarElement.svelte"
2023-09-28 04:02:42 +02:00
/**
* Number between 0 and 100. Every 10 points, another half star is added
*/
2023-09-28 23:50:27 +02:00
export let score: number
2023-09-28 04:02:42 +02:00
2023-09-28 23:50:27 +02:00
let cutoffs = [20, 40, 60, 80, 100]
2023-09-28 04:02:42 +02:00
export let starSize = "w-h h-4"
export let readonly = false
2023-09-28 04:02:42 +02:00
</script>
2023-09-28 23:50:27 +02:00
2023-09-28 04:02:42 +02:00
{#if score !== undefined}
2023-09-28 23:50:27 +02:00
<div class="flex" on:mouseout>
2023-12-21 17:36:43 +01:00
{#each cutoffs as cutoff, i}
<StarElement {readonly} {score} {i} {cutoff} {starSize} on:hover on:click />
2023-09-28 04:02:42 +02:00
{/each}
2023-09-28 23:50:27 +02:00
</div>
{/if}