From 5d0be19640724b650051f78c37aedc1410f2d40a Mon Sep 17 00:00:00 2001 From: Ernane Ferreira Date: Mon, 18 Dec 2023 20:43:59 -0300 Subject: [PATCH] bug-fix: not unique linearGradient id when component is used multiple times #12 --- src/Stars.svelte | 46 +++++++++++----------------------------------- 1 file changed, 11 insertions(+), 35 deletions(-) diff --git a/src/Stars.svelte b/src/Stars.svelte index f6891e9..579607c 100644 --- a/src/Stars.svelte +++ b/src/Stars.svelte @@ -3,10 +3,11 @@ export let config = { readOnly: false, countStars: 5, - range: {min: 0, max: 5, step: 0.001}, + range: { min: 0, max: 5, step: 0.001 }, score: 0.0, showScore: true, - name: "", + name: "stars", + scoreFormat: function(){ return `(${this.score.toFixed(0)}/${this.countStars})` }, starConfig: { size: 30, fillColor: '#F9ED4F', @@ -22,11 +23,11 @@
{#each Array(config.countStars) as star, id} {#if parseInt(config.score) == id} - + {:else if parseInt(config.score) > id} - + {:else} - + {/if} {/each}
@@ -44,34 +45,9 @@