mirror of
https://github.com/wukko/cobalt.git
synced 2025-06-01 06:20:13 +02:00
web/ProcessingStatus: refactor to svelte 5 & add aria label
This commit is contained in:
parent
773d771c40
commit
294273e2a7
5
web/i18n/en/a11y/queue.json
Normal file
5
web/i18n/en/a11y/queue.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"status.default": "processing queue",
|
||||||
|
"status.completed": "processing queue. all tasks are completed.",
|
||||||
|
"status.ongoing": "processing queue. ongoing tasks."
|
||||||
|
}
|
@ -1,19 +1,37 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { t } from "$lib/i18n/translations";
|
||||||
import IconArrowDown from "@tabler/icons-svelte/IconArrowDown.svelte";
|
import IconArrowDown from "@tabler/icons-svelte/IconArrowDown.svelte";
|
||||||
|
|
||||||
export let indeterminate = false;
|
type Props = {
|
||||||
export let progress: number = 0;
|
indeterminate?: boolean;
|
||||||
export let expandAction: () => void;
|
progress?: number;
|
||||||
|
expandAction: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
$: progressStroke = `${progress}, 100`;
|
let {
|
||||||
|
indeterminate = false,
|
||||||
|
progress = $bindable(0),
|
||||||
|
expandAction
|
||||||
|
}: Props = $props();
|
||||||
|
|
||||||
|
let progressStroke = $derived(`${progress}, 100`);
|
||||||
const indeterminateStroke = "15, 5";
|
const indeterminateStroke = "15, 5";
|
||||||
|
|
||||||
|
let ariaState = $derived(
|
||||||
|
progress > 0 && progress < 100
|
||||||
|
? "ongoing"
|
||||||
|
: progress >= 100
|
||||||
|
? "completed"
|
||||||
|
: "default"
|
||||||
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
id="processing-status"
|
id="processing-status"
|
||||||
on:click={expandAction}
|
onclick={expandAction}
|
||||||
class="button"
|
class="button"
|
||||||
class:completed={progress >= 100}
|
class:completed={progress >= 100}
|
||||||
|
aria-label={$t(`a11y.queue.status.${ariaState}`)}
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
id="progress-ring"
|
id="progress-ring"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user