Skip to content

Commit eb230a0

Browse files
committed
fix(Switch): fixed disabled style error in dark mode
1 parent 64a089e commit eb230a0

File tree

5 files changed

+14
-23
lines changed

5 files changed

+14
-23
lines changed

src/common/style/theme/_components.less

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,7 @@
1818
--td-slider-dot-disabled-border-color: var(--td-gray-color-12);
1919

2020
--td-picker-transparent-color: transparent;
21+
22+
--td-switch-dot-disabled-color: var(--td-font-white-2);
2123
}
2224
}

src/switch/README.en-US.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Name | Default Value | Description
3030
-- | -- | --
3131
--td-switch-checked-color | @brand-color | -
3232
--td-switch-checked-disabled-color | @brand-color-disabled | -
33-
--td-switch-dot-border-color | @bg-color-secondarycontainer | -
33+
--td-switch-dot-disabled-color | @font-white-1 | -
3434
--td-switch-dot-horizontal-margin | 6rpx | -
3535
--td-switch-dot-large-size | 52rpx | -
3636
--td-switch-dot-plain-horizontal-margin | 10rpx | -
@@ -45,7 +45,7 @@ Name | Default Value | Description
4545
--td-switch-icon-size | 40rpx | -
4646
--td-switch-icon-small-size | 32rpx | -
4747
--td-switch-label-checked-color | @switch-checked-color | -
48-
--td-switch-label-color | @font-gray-4 | -
48+
--td-switch-label-color | @bg-color-secondarycontainer-active | -
4949
--td-switch-label-font-size | 28rpx | -
5050
--td-switch-label-large-font-size | 32rpx | -
5151
--td-switch-label-small-font-size | 24rpx | -
@@ -56,6 +56,6 @@ Name | Default Value | Description
5656
--td-switch-small-height | 48rpx | -
5757
--td-switch-small-radius | calc(@switch-small-height / 2) | -
5858
--td-switch-small-width | 78rpx | -
59-
--td-switch-unchecked-color | @font-gray-4 | -
59+
--td-switch-unchecked-color | @bg-color-secondarycontainer-active | -
6060
--td-switch-unchecked-disabled-color | @bg-color-component-disabled | -
61-
--td-switch-width | 90rpx | -
61+
--td-switch-width | 90rpx | -

src/switch/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ change | `(value: SwitchValue)` | 数据发生变化时触发
7474
-- | -- | --
7575
--td-switch-checked-color | @brand-color | -
7676
--td-switch-checked-disabled-color | @brand-color-disabled | -
77-
--td-switch-dot-border-color | @bg-color-secondarycontainer | -
77+
--td-switch-dot-disabled-color | @font-white-1 | -
7878
--td-switch-dot-horizontal-margin | 6rpx | -
7979
--td-switch-dot-large-size | 52rpx | -
8080
--td-switch-dot-plain-horizontal-margin | 10rpx | -
@@ -89,7 +89,7 @@ change | `(value: SwitchValue)` | 数据发生变化时触发
8989
--td-switch-icon-size | 40rpx | -
9090
--td-switch-icon-small-size | 32rpx | -
9191
--td-switch-label-checked-color | @switch-checked-color | -
92-
--td-switch-label-color | @font-gray-4 | -
92+
--td-switch-label-color | @bg-color-secondarycontainer-active | -
9393
--td-switch-label-font-size | 28rpx | -
9494
--td-switch-label-large-font-size | 32rpx | -
9595
--td-switch-label-small-font-size | 24rpx | -
@@ -100,6 +100,6 @@ change | `(value: SwitchValue)` | 数据发生变化时触发
100100
--td-switch-small-height | 48rpx | -
101101
--td-switch-small-radius | calc(@switch-small-height / 2) | -
102102
--td-switch-small-width | 78rpx | -
103-
--td-switch-unchecked-color | @font-gray-4 | -
103+
--td-switch-unchecked-color | @bg-color-secondarycontainer-active | -
104104
--td-switch-unchecked-disabled-color | @bg-color-component-disabled | -
105-
--td-switch-width | 90rpx | -
105+
--td-switch-width | 90rpx | -

src/switch/switch.less

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
@switch-checked-disabled-color: var(--td-switch-checked-disabled-color, @brand-color-disabled);
55
@switch-unchecked-color: var(--td-switch-unchecked-color, @bg-color-secondarycontainer-active);
66
@switch-unchecked-disabled-color: var(--td-switch-unchecked-disabled-color, @bg-color-component-disabled);
7+
@switch-dot-disabled-color: var(--td-switch-dot-disabled-color, @font-white-1);
78

89
@switch-width: var(--td-switch-width, 90rpx);
910
@switch-height: var(--td-switch-height, 56rpx);
@@ -24,7 +25,6 @@
2425
@switch-dot-horizontal-margin: var(--td-switch-dot-horizontal-margin, 6rpx);
2526
@switch-dot-plain-horizontal-margin: var(--td-switch-dot-plain-horizontal-margin, 10rpx);
2627
@switch-dot-shadow: var(--td-switch-dot-shadow, @shadow-1);
27-
@switch-dot-border-color: var(--td-switch-dot-border-color, @gray-color-4);
2828

2929
// large dot
3030
@switch-dot-large-size: var(--td-switch-dot-large-size, 52rpx);
@@ -153,19 +153,8 @@
153153
transform: translateY(-50%);
154154
box-shadow: @switch-dot-shadow;
155155

156-
&:after {
157-
content: '';
158-
display: block;
159-
position: absolute;
160-
left: 0;
161-
top: 0;
162-
width: 200%;
163-
height: 200%;
164-
border: 1px solid @switch-dot-border-color;
165-
border-radius: 50%;
166-
transform: scale(0.5);
167-
transform-origin: 0 0;
168-
box-sizing: border-box;
156+
&--disabled {
157+
background-color: @switch-dot-disabled-color;
169158
}
170159

171160
&--large {

src/switch/switch.wxml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
class="{{_.cls(classPrefix + '__body', [['checked', checked], ['disabled', disabled || loading], size])}} {{prefix}}-class-body"
1313
>
1414
<view
15-
class="{{_.cls(classPrefix + '__dot', [['checked', checked], ['plain', label.length != 2 && icon.length != 2 && !loading], size])}} {{prefix}}-class-dot"
15+
class="{{_.cls(classPrefix + '__dot', [['checked', checked], ['disabled', disabled], ['plain', label.length != 2 && icon.length != 2 && !loading], size])}} {{prefix}}-class-dot"
1616
aria-hidden="{{true}}"
1717
>
1818
<view

0 commit comments

Comments
 (0)