Skip to content

Commit 081a2f5

Browse files
refactor(time-select): [time-select] refactor the theme (#2275)
* refactor(time-select): [time-select] refactor the theme * refactor(time-select): [time-select] refactor the theme * refactor(time-select): [time-select] refactor the theme * refactor(time-select): [time-select] refactor the theme * refactor(time-select): [time-select] refactor the theme
1 parent 766f054 commit 081a2f5

File tree

3 files changed

+24
-31
lines changed

3 files changed

+24
-31
lines changed

examples/sites/demos/pc/app/time-select/size-medium.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ test('medium 尺寸', async ({ page }) => {
77
const smallBox = page.getByRole('textbox', { name: '尺寸: small' })
88
const miniBox = page.getByRole('textbox', { name: '尺寸: mini' })
99
await expect(mediumBox).toHaveCSS('height', '40px')
10-
await expect(smallBox).toHaveCSS('height', '32px')
10+
await expect(smallBox).toHaveCSS('height', '28px')
1111
await expect(miniBox).toHaveCSS('height', '24px')
1212
})

packages/theme/src/time-select/index.less

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,44 +18,44 @@
1818
@time-select-scrollbar-cls: ~'@{css-prefix}scrollbar';
1919

2020
.@{time-select-prefix-cls} {
21-
.component-css-vars-time-select();
21+
.inject-TimeSelect-vars();
2222

23-
height: var(--ti-time-select-height);
23+
height: 242px;
2424
.@{time-select-scrollbar-cls} {
25-
height: var(--ti-time-select-scrollbar-height);
25+
height: 242px;
2626
.@{css-prefix}scrollbar__wrap {
27-
max-height: var(--ti-time-select-scrollbar-wrap-max-height);
27+
max-height: unset;
2828
}
2929
}
3030

3131
& &__item {
32-
color: var(--ti-time-select-item-text-color);
33-
font-size: var(--ti-time-select-item-font-size);
34-
padding: 0 var(--ti-time-select-item-padding-horizontal);
35-
line-height: var(--ti-time-select-item-line-height);
36-
height: var(--ti-time-select-item-height);
32+
color: var(--tv-TimeSelect-item-text-color);
33+
font-size: var(--tv-TimeSelect-item-font-size);
34+
padding: 0 var(--tv-TimeSelect-item-padding-horizontal);
35+
line-height: 32px;
36+
height: 32px;
3737

3838

3939
&.selected:not(.disabled) {
40-
color: var(--ti-time-select-item-selected-text-color);
41-
background-color: var(--ti-time-select-item-select-hover-bg-color);
40+
color: var(--tv-TimeSelect-item-selected-text-color);
41+
background-color: var(--tv-TimeSelect-item-select-hover-bg-color);
4242
}
4343

4444
&:not(.disabled):hover {
45-
background-color: var(--ti-time-select-item-hover-bg-color);
45+
background-color: var(--tv-TimeSelect-item-hover-bg-color);
4646
cursor: pointer;
4747
}
4848

4949
&.disabled {
50-
color: var(--ti-time-select-item-disabled-text-color);
50+
color: var(--tv-TimeSelect-item-disabled-text-color);
5151
cursor: not-allowed;
5252
}
5353
}
5454
.@{picker-panel-prefix-cls} {
5555
&__content {
5656
padding-left: 0;
5757
padding-right: 0;
58-
padding-top: var(--ti-time-select-content-padding-top);
58+
padding-top: var(--tv-TimeSelect-content-padding-top);
5959
}
6060
}
6161
}

packages/theme/src/time-select/vars.less

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,21 @@
1010
*
1111
*/
1212

13-
.component-css-vars-time-select() {
14-
// 时间选择选项高度
15-
--ti-time-select-item-height: var(--ti-common-size-height-normal, 32px);
13+
.inject-TimeSelect-vars() {
1614
// 时间选择选项字体色
17-
--ti-time-select-item-text-color: var(--ti-common-color-text-primary, #191919);
15+
--tv-TimeSelect-item-text-color: var(--tv-color-text);
1816
// 时间选择选项字号
19-
--ti-time-select-item-font-size: var(--ti-common-font-size-base, 14px);
20-
// 时间选择选项行高
21-
--ti-time-select-item-line-height: var(--ti-common-size-height-normal, 32px);
17+
--tv-TimeSelect-item-font-size: var(--tv-font-size-md);
2218
// 时间选择选项左右内边距
23-
--ti-time-select-item-padding-horizontal: var(--ti-common-space-4x, 16px);
19+
--tv-TimeSelect-item-padding-horizontal: var(--tv-space-xl);
2420
// 时间选择选项悬浮背景色
25-
--ti-time-select-item-hover-bg-color: var(--ti-common-color-bg-normal, #f5f5f5);
21+
--tv-TimeSelect-item-hover-bg-color: var(--tv-color-bg-hover);
2622
// 时间选择选项禁用文本色
27-
--ti-time-select-item-disabled-text-color: var(--ti-common-color-text-disabled, #c2c2c2);
23+
--tv-TimeSelect-item-disabled-text-color: var(--tv-color-text-disabled);
2824
// 时间选择选项悬浮背景色(选中项)
29-
--ti-time-select-item-select-hover-bg-color: var(--ti-common-color-selected-background, #f5f5f5);
25+
--tv-TimeSelect-item-select-hover-bg-color: var(--tv-color-bg-active);
3026
// 时间选择选项字体色(选中项)
31-
--ti-time-select-item-selected-text-color: var(--ti-common-color-text-highlight, #1476ff);
27+
--tv-TimeSelect-item-selected-text-color: var(--tv-color-text-active);
3228
// 面板高度
33-
--ti-time-select-height: 242px;
34-
--ti-time-select-scrollbar-height: 242px;
35-
--ti-time-select-scrollbar-wrap-max-height: unset;
36-
--ti-time-select-content-padding-top: var(--ti-common-space-2x, 8px);
29+
--tv-TimeSelect-content-padding-top: var(--tv-space-md);
3730
}

0 commit comments

Comments
 (0)