aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/Slider.svelte
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-02-25 06:52:08 -0800
committerAdam Soltys <[email protected]>2023-02-25 06:52:08 -0800
commit1ac4c9f8dafc12cc247ce301d76f45fddeac477f (patch)
tree200a01737e649722bcf93ad208c18365bc1f1201 /src/components/Slider.svelte
parent0b9e3e5edf9f37e3cd692f2db801fa2bd5720314 (diff)
parent0dd7eab893bb4aad5853ea92cdb8e70e421dc1b8 (diff)
downloadcoinos-ui-1ac4c9f8dafc12cc247ce301d76f45fddeac477f.tar.gz
coinos-ui-1ac4c9f8dafc12cc247ce301d76f45fddeac477f.zip
Merge branch 'master' into hashme
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>