ProgressRing used text-accent (#a1dcd8) on a percentage text label — same WCAG 2.1 AA failure as #341. Switched to text-primary. Also adds ESLint no-restricted-syntax rule (scoped to *.svelte files) that blocks future text-accent usage in JavaScript string literals inside Svelte class expressions. The rule caught both violations at once; both are now fixed. The rule is scoped to .svelte files so test assertions against 'text-accent' strings in .spec.ts files are unaffected. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
27 lines
685 B
Svelte
27 lines
685 B
Svelte
<script lang="ts">
|
|
let { percentage }: { percentage: number } = $props();
|
|
</script>
|
|
|
|
<div class="flex flex-col items-center">
|
|
<svg width="36" height="36" viewBox="0 0 20 20" aria-hidden="true">
|
|
<circle cx="10" cy="10" r="7" fill="none" stroke="var(--c-line)" stroke-width="2" />
|
|
<circle
|
|
class="fill-arc"
|
|
cx="10"
|
|
cy="10"
|
|
r="7"
|
|
fill="none"
|
|
stroke="var(--c-accent)"
|
|
stroke-width="2"
|
|
stroke-linecap="round"
|
|
transform="rotate(-90 10 10)"
|
|
stroke-dasharray="{(percentage / 100) * 43.98} 43.98"
|
|
/>
|
|
</svg>
|
|
<span
|
|
class="block text-center font-sans text-xs font-bold {percentage > 0 ? 'text-primary' : 'text-gray-400'}"
|
|
>
|
|
{percentage}%
|
|
</span>
|
|
</div>
|