2022-02-01 21:45:55 +08:00
|
|
|
<script>
|
2022-02-01 23:46:50 +08:00
|
|
|
export let value, setValue, theme;
|
|
|
|
export let minimum, maximum, step;
|
2022-02-01 21:45:55 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<div class="input-slider text-center" {theme}>
|
2022-02-01 23:46:50 +08:00
|
|
|
<input
|
|
|
|
type="range"
|
|
|
|
class="range w-full appearance-none transition rounded h-4"
|
|
|
|
on:input={(e) => setValue(parseFloat(e.target.value))}
|
|
|
|
{value}
|
|
|
|
min={minimum}
|
|
|
|
max={maximum}
|
|
|
|
{step}
|
|
|
|
/>
|
|
|
|
<div class="value inline-block mx-auto mt-1 px-2 py-0.5 rounded">{value}</div>
|
2022-02-01 21:45:55 +08:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<style lang="postcss">
|
2022-02-01 23:46:50 +08:00
|
|
|
.range::-webkit-slider-thumb {
|
|
|
|
-webkit-appearance: none;
|
|
|
|
@apply appearance-none w-5 h-5 rounded cursor-pointer;
|
|
|
|
}
|
|
|
|
.range::-moz-range-thumb {
|
|
|
|
@apply appearance-none w-5 h-5 rounded cursor-pointer;
|
|
|
|
}
|
2022-02-01 21:45:55 +08:00
|
|
|
|
2022-02-01 23:46:50 +08:00
|
|
|
.input-slider[theme="default"] {
|
|
|
|
.range {
|
|
|
|
@apply bg-white dark:bg-gray-800 shadow h-3 transition hover:shadow-md;
|
|
|
|
}
|
|
|
|
.range::-webkit-slider-thumb {
|
|
|
|
@apply bg-gradient-to-b from-yellow-400 to-yellow-500 dark:from-red-500 dark:to-red-600 shadow;
|
|
|
|
}
|
|
|
|
.range::-moz-range-thumb {
|
|
|
|
@apply bg-gradient-to-b from-yellow-400 to-yellow-500 shadow;
|
|
|
|
}
|
|
|
|
.value {
|
|
|
|
@apply bg-gray-100 dark:bg-gray-600 font-semibold;
|
|
|
|
}
|
|
|
|
}
|
2022-02-01 21:45:55 +08:00
|
|
|
</style>
|