Skip to content

Commit 26543e8

Browse files
authored
[improvement] Slider: add less vars (youzan#3125)
1 parent e5fc82e commit 26543e8

2 files changed

Lines changed: 18 additions & 8 deletions

File tree

packages/slider/index.less

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@
33
.van-slider {
44
position: relative;
55
border-radius: 999px;
6-
background-color: @gray-light;
6+
background-color: @slider-inactive-background-color;
77

88
&__bar {
99
position: relative;
1010
border-radius: inherit;
11-
background-color: @blue;
11+
background-color: @slider-active-background-color;
1212
}
1313

1414
&__button {
15-
width: 20px;
16-
height: 20px;
17-
border-radius: 50%;
18-
background-color: @white;
19-
box-shadow: 0 1px 2px rgba(0, 0, 0, .5);
15+
width: @slider-button-width;
16+
height: @slider-button-height;
17+
box-shadow: @slider-button-box-shadow;
18+
border-radius: @slider-button-border-radius;
19+
background-color: @slider-button-background-color;
2020

2121
&-wrapper {
2222
position: absolute;
@@ -37,7 +37,7 @@
3737
}
3838

3939
&--disabled {
40-
opacity: .3;
40+
opacity: @slider-disabled-opacity;
4141
}
4242

4343
&--vertical {

packages/style/var.less

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,16 @@
186186
@radio-disabled-label-color: @gray;
187187
@radio-disabled-background-color: @border-color;
188188

189+
// Slider
190+
@slider-active-background-color: @blue;
191+
@slider-inactive-background-color: @gray-light;
192+
@slider-disabled-opacity: .3;
193+
@slider-button-width: 20px;
194+
@slider-button-height: 20px;
195+
@slider-button-border-radius: 50%;
196+
@slider-button-background-color: @white;
197+
@slider-button-box-shadow: 0 1px 2px rgba(0, 0, 0, .5);
198+
189199
// Swipe
190200
@swipe-indicator: 6px;
191201

0 commit comments

Comments
 (0)