aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/Slider.svelte
diff options
context:
space:
mode:
authorJohn Barratt <[email protected]>2023-03-07 10:29:49 -0800
committerJohn Barratt <[email protected]>2023-03-07 10:29:49 -0800
commit8ef9568cd1bd822495ce005d4e4cfaa6cb0d92ce (patch)
tree4ea5530cc2b7e5d970dc8a84cacfecfe2cce46b7 /src/components/Slider.svelte
parentc97fb43abba375920fff361ec5fa4eb64a5a0d3f (diff)
parent0f44e3283c25c9783a52cf20957661da49d2f90b (diff)
downloadcoinos-ui-notifications.tar.gz
coinos-ui-notifications.zip
Merge branch 'master' of https://github.com/coinos/coinos-ui into notificationsnotifications
Diffstat (limited to 'src/components/Slider.svelte')
-rw-r--r--src/components/Slider.svelte56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/components/Slider.svelte b/src/components/Slider.svelte
new file mode 100644
index 00000000..3c94d127
--- /dev/null
+++ b/src/components/Slider.svelte
@@ -0,0 +1,56 @@
+<script>
+ export let value,
+ handle,
+ min = 0,
+ max = 100;
+</script>
+
+<input
+ id="slider"
+ type="range"
+ {min}
+ {max}
+ bind:value
+ class="px-0 py-0 my-5"
+ style="--bgPercent: {((value - min) * 100) / (max - min)}%;"
+ on:input={handle}
+/>
+
+<style>
+ #slider {
+ -webkit-appearance: none;
+ width: 100%;
+ height: 6px;
+ border-radius: 5px;
+ background: linear-gradient(
+ to right,
+ black 0%,
+ black var(--bgPercent),
+ #f5f7fa var(--bgPercent),
+ #f5f7fa 100%
+ );
+ outline: none;
+ }
+
+ #slider:active {
+ background-color: black;
+ }
+
+ #slider::-webkit-slider-thumb {
+ -webkit-appearance: none;
+ appearance: none;
+ width: 30px;
+ height: 30px;
+ border-radius: 50%;
+ background: black;
+ cursor: pointer;
+ }
+
+ #slider::-moz-range-thumb {
+ width: 30px;
+ height: 30px;
+ border-radius: 50%;
+ background: black;
+ cursor: pointer;
+ }
+</style>