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"
|
2023-12-24 05:01:10 +01:00
|
|
|
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}
|
2023-12-24 05:01:10 +01:00
|
|
|
<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}
|