mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 11:36:36 +00:00
Added the status for the ProgressBarUx
This commit is contained in:
parent
2ce0dd60ff
commit
e2a0ce9ac7
1 changed files with 10 additions and 2 deletions
|
@ -3,10 +3,14 @@
|
||||||
|
|
||||||
let max = 328;
|
let max = 328;
|
||||||
let value = 0;
|
let value = 0;
|
||||||
|
let status = "active";
|
||||||
|
|
||||||
$: helperText =
|
$: helperText =
|
||||||
value > 0 ? value.toFixed(0) + "MB of " + max + "MB" : "Press start";
|
value > 0 ? value.toFixed(0) + "MB of " + max + "MB" : "Press start";
|
||||||
$: if (value === max) helperText = "Done";
|
$: if (value === max) {
|
||||||
|
helperText = "Done";
|
||||||
|
status = "finished";
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
|
@ -14,6 +18,7 @@
|
||||||
value="{value}"
|
value="{value}"
|
||||||
max="{max}"
|
max="{max}"
|
||||||
helperText="{helperText}"
|
helperText="{helperText}"
|
||||||
|
status="{status}"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ButtonSet style="margin-top: var(--cds-spacing-08)">
|
<ButtonSet style="margin-top: var(--cds-spacing-08)">
|
||||||
|
@ -37,7 +42,10 @@
|
||||||
<Button
|
<Button
|
||||||
kind="tertiary"
|
kind="tertiary"
|
||||||
disabled="{value !== max}"
|
disabled="{value !== max}"
|
||||||
on:click="{() => (value = 0)}"
|
on:click="{() => {
|
||||||
|
value = 0;
|
||||||
|
status = 'active';
|
||||||
|
}}"
|
||||||
>
|
>
|
||||||
Reset
|
Reset
|
||||||
</Button>
|
</Button>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue