working ProgressCircle
This commit is contained in:
parent
b9ec7568d8
commit
341b71cfd9
|
@ -1,11 +1,17 @@
|
|||
<script>
|
||||
// WIP! Does not yet work.
|
||||
import "@spectrum-css/progresscircle/dist/index-vars.css"
|
||||
import { tweened } from "svelte/motion"
|
||||
import { cubicOut } from "svelte/easing"
|
||||
|
||||
export let small
|
||||
export let large
|
||||
export let size = "M"
|
||||
function convertSize(size) {
|
||||
switch (size) {
|
||||
case "S":
|
||||
return "small"
|
||||
case "L":
|
||||
return "large"
|
||||
default:
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
export let value = false
|
||||
export let minValue = 0
|
||||
|
@ -13,6 +19,9 @@
|
|||
|
||||
let subMask1Style
|
||||
let subMask2Style
|
||||
$: calculateSubMasks(value)
|
||||
|
||||
function calculateSubMasks(value) {
|
||||
if (value) {
|
||||
let percentage = ((value - minValue) / (maxValue - minValue)) * 100
|
||||
let angle
|
||||
|
@ -26,16 +35,16 @@
|
|||
subMask2Style = `transform: rotate(${angle}deg);`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export let overBackground
|
||||
</script>
|
||||
|
||||
<div
|
||||
on:click
|
||||
class:spectrum-ProgressBar--indeterminate={!value}
|
||||
class:spectrum-ProgressCircle--small={small}
|
||||
class:spectrum-ProgressCircle--large={large}
|
||||
class:spectrum-ProgressCircle--overBackground={overBackground}
|
||||
class="spectrum-ProgressCircle"
|
||||
class="spectrum-ProgressCircle spectrum-ProgressCircle--{convertSize(size)}"
|
||||
>
|
||||
<div class="spectrum-ProgressCircle-track" />
|
||||
<div class="spectrum-ProgressCircle-fills">
|
||||
|
|
Loading…
Reference in New Issue