chore: use writable derived in more places (#17248)

chore(web): use writable derived in more places
This commit is contained in:
Ben McCann 2025-03-31 07:15:52 -07:00 committed by GitHub
parent d613f15606
commit b25914c2a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 14 additions and 37 deletions

View file

@ -14,15 +14,11 @@
let { count = 5, rating, readOnly = false, onRating }: Props = $props();
let ratingSelection = $state(rating);
let ratingSelection = $derived(rating);
let hoverRating = $state(0);
let focusRating = $state(0);
let timeoutId: ReturnType<typeof setTimeout> | undefined;
$effect(() => {
ratingSelection = rating;
});
const starIcon =
'M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.007 5.404.433c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.433 2.082-5.006z';
const id = generateId();