Skip to content

Commit d5d25f7

Browse files
authored
fix(Checkbox): fix border width error (Tencent#3069)
* fix(Checkbox): fix border width error * docs(Checkbox): update css vars
1 parent 7604d86 commit d5d25f7

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

src/checkbox/README.en-US.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,23 +50,24 @@ change | `(value: CheckboxGroupValue, context: { value: boolean|number|string, l
5050

5151

5252
### CSS Variables
53+
5354
The component provides the following CSS variables, which can be used to customize styles.
5455
Name | Default Value | Description
5556
-- | -- | --
5657
--td-checkbox-bg-color | @bg-color-container | -
5758
--td-checkbox-border-color | @component-stroke | -
58-
--td-checkbox-description-color | @font-gray-2 | -
59-
--td-checkbox-description-disabled-color | @font-gray-4 | -
59+
--td-checkbox-description-color | @text-color-secondary | -
60+
--td-checkbox-description-disabled-color | @text-color-disabled | -
6061
--td-checkbox-description-line-height | 44rpx | -
6162
--td-checkbox-font-size | 32rpx | -
6263
--td-checkbox-icon-checked-color | @brand-color | -
63-
--td-checkbox-icon-color | @gray-color-4 | -
64+
--td-checkbox-icon-color | @component-border | -
6465
--td-checkbox-icon-disabled-bg-color | @bg-color-component-disabled | -
6566
--td-checkbox-icon-disabled-color | @brand-color-disabled | -
6667
--td-checkbox-icon-size | 48rpx | -
6768
--td-checkbox-tag-active-bg-color | @brand-color-light | -
6869
--td-checkbox-tag-active-color | @brand-color | -
69-
--td-checkbox-title-color | @font-gray-1 | -
70-
--td-checkbox-title-disabled-color | @font-gray-4 | -
70+
--td-checkbox-title-color | @text-color-primary | -
71+
--td-checkbox-title-disabled-color | @text-color-disabled | -
7172
--td-checkbox-title-line-height | 48rpx | -
7273
--td-checkbox-vertical-padding | 32rpx | -

src/checkbox/README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,24 +122,25 @@ default-value | Array | undefined | 选中值。非受控属性。TS 类型:`T
122122
change | `(value: CheckboxGroupValue, context: { value: boolean|number|string, label: boolean|number|string })` | 值变化时触发。`context` 表示当前点击项内容。
123123

124124

125-
### CSS 变量
125+
### CSS Variables
126+
126127
组件提供了下列 CSS 变量,可用于自定义样式。
127128
名称 | 默认值 | 描述
128129
-- | -- | --
129130
--td-checkbox-bg-color | @bg-color-container | -
130131
--td-checkbox-border-color | @component-stroke | -
131-
--td-checkbox-description-color | @font-gray-2 | -
132-
--td-checkbox-description-disabled-color | @font-gray-4 | -
132+
--td-checkbox-description-color | @text-color-secondary | -
133+
--td-checkbox-description-disabled-color | @text-color-disabled | -
133134
--td-checkbox-description-line-height | 44rpx | -
134135
--td-checkbox-font-size | 32rpx | -
135136
--td-checkbox-icon-checked-color | @brand-color | -
136-
--td-checkbox-icon-color | @gray-color-4 | -
137+
--td-checkbox-icon-color | @component-border | -
137138
--td-checkbox-icon-disabled-bg-color | @bg-color-component-disabled | -
138139
--td-checkbox-icon-disabled-color | @brand-color-disabled | -
139140
--td-checkbox-icon-size | 48rpx | -
140141
--td-checkbox-tag-active-bg-color | @brand-color-light | -
141142
--td-checkbox-tag-active-color | @brand-color | -
142-
--td-checkbox-title-color | @font-gray-1 | -
143-
--td-checkbox-title-disabled-color | @font-gray-4 | -
143+
--td-checkbox-title-color | @text-color-primary | -
144+
--td-checkbox-title-disabled-color | @text-color-disabled | -
144145
--td-checkbox-title-line-height | 48rpx | -
145146
--td-checkbox-vertical-padding | 32rpx | -

src/checkbox/checkbox.less

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
@checkbox: ~'@{prefix}-checkbox';
44

5-
@checkbox-border-width: 6rpx;
5+
@checkbox-border-width: 4rpx;
66
@checkbox-icon-size: var(--td-checkbox-icon-size, 48rpx);
77
@checkbox-font-size: var(--td-checkbox-font-size, 32rpx);
88
@checkbox-title-line-height: var(--td-checkbox-title-line-height, 48rpx);
@@ -14,7 +14,7 @@
1414
@checkbox-title-disabled-color: var(--td-checkbox-title-disabled-color, @text-color-disabled);
1515
@checkbox-description-color: var(--td-checkbox-description-color, @text-color-secondary);
1616
@checkbox-description-disabled-color: var(--td-checkbox-description-disabled-color, @text-color-disabled);
17-
@checkbox-icon-color: var(--td-checkbox-icon-color, @text-color-disabled);
17+
@checkbox-icon-color: var(--td-checkbox-icon-color, @component-border);
1818
@checkbox-icon-disabled-color: var(--td-checkbox-icon-disabled-color, @brand-color-disabled);
1919
@checkbox-icon-disabled-bg-color: var(--td-checkbox-icon-disabled-bg-color, @bg-color-component-disabled);
2020
@checkbox-icon-checked-color: var(--td-checkbox-icon-checked-color, @brand-color);
@@ -99,7 +99,7 @@
9999
&-circle {
100100
width: calc((@checkbox-icon-size - @checkbox-border-width) * 2);
101101
height: calc((@checkbox-icon-size - @checkbox-border-width) * 2);
102-
border: @checkbox-border-width solid @checkbox-icon-color;
102+
border: calc(@checkbox-border-width * 2) solid @checkbox-icon-color;
103103
border-radius: 50%;
104104
position: absolute;
105105
top: 50%;
@@ -115,8 +115,7 @@
115115
&-rectangle {
116116
width: calc((@checkbox-icon-size - @checkbox-border-width * 2) * 2);
117117
height: calc((@checkbox-icon-size - @checkbox-border-width * 2) * 2);
118-
border: @checkbox-border-width solid @checkbox-icon-color;
119-
border-radius: 4rpx;
118+
border: calc(@checkbox-border-width * 2) solid @checkbox-icon-color;
120119
position: absolute;
121120
top: 50%;
122121
left: 50%;

0 commit comments

Comments
 (0)