Add monochrome slider support with styling adjustments
This commit is contained in:
1 parent
78c4a6cb8e
commit
ed53c41a87
2 files changed
+12
-1
No files matched your search
+11
-1
@@ -4,6 +4,7 @@ interface SliderProps {
|
||||
max?: number
|
||||
step?: number
|
||||
dontUpdateImmediately?: boolean
|
||||
monochrome?: boolean
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<SliderProps>(), {
|
||||
@@ -11,6 +12,7 @@ const props = withDefaults(defineProps<SliderProps>(), {
|
||||
max: 100,
|
||||
step: 1,
|
||||
dontUpdateImmediately: false,
|
||||
monochrome: false,
|
||||
})
|
||||
|
||||
const value = defineModel<number>()
|
||||
@@ -67,7 +69,11 @@ const onMouseDown = (event: MouseEvent) => {
|
||||
<template>
|
||||
<div ref="slider-ref" class="slider" @mousedown="onMouseDown">
|
||||
<div class="track">
|
||||
<div class="fill" :style="{ width: percentage + '%' }" />
|
||||
<div
|
||||
class="fill"
|
||||
:class="{ monochrome }"
|
||||
:style="{ width: percentage + '%' }"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -98,4 +104,8 @@ const onMouseDown = (event: MouseEvent) => {
|
||||
background: $color-accent;
|
||||
border-radius: 999px;
|
||||
}
|
||||
|
||||
.slider .monochrome {
|
||||
background-color: $color-slider-monochrome;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user