-
Notifications
You must be signed in to change notification settings - Fork 278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(theme): [filter-panel] refactor filter-panel theme vars #2288
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,119 +16,117 @@ | |
@filter-box-prefix-cls: ~'@{css-prefix}filter-box'; | ||
|
||
.@{filter-box-prefix-cls} { | ||
.component-css-vars-filter-box(); | ||
.inject-FilterBox-vars(); | ||
|
||
width: fit-content; | ||
height: var(--ti-filter-box-btn-height); | ||
line-height: var(--ti-filter-box-btn-height); | ||
height: var(--tv-FilterBox-btn-height); | ||
line-height: var(--tv-FilterBox-btn-height); | ||
border-radius: 4px; | ||
background: var(--ti-filter-box-btn-bg-color); | ||
color: #161e26; | ||
padding: 4px var(--ti-filter-box-btn-padding-horizontal); | ||
background: var(--tv-FilterBox-btn-bg-color); | ||
color: var(--tv-FilterBox-btn-text-color); | ||
padding: 4px var(--tv-FilterBox-btn-padding-x); | ||
Comment on lines
+22
to
+27
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Issues Found: Missing CSS Variable Definitions The updated CSS variables in
🔗 Analysis chainLGTM: CSS variable naming convention update The update of CSS variable names from Please ensure that these new variables are properly defined in the corresponding 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Verify the new CSS variable definitions in vars.less
# Test: Search for the new variable definitions
rg --type less -e '--tv-FilterBox-btn-height' -e '--tv-FilterBox-btn-bg-color' -e '--tv-FilterBox-btn-text-color' -e '--tv-FilterBox-btn-padding-x' -e '--tv-FilterBox-btn-font-size' packages/theme/src/filter-box/vars.less
Length of output: 689 |
||
display: flex; | ||
align-items: center; | ||
font-size: 12px; | ||
|
||
&:hover { | ||
background: var(--ti-filter-box-btn-hover-bg-color); | ||
} | ||
font-size: var(--tv-FilterBox-btn-font-size); | ||
|
||
&.disabled { | ||
cursor: not-allowed; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Replace hardcoded disabled state colors with variables The Example changes: - color: #b5bbc1;
+ color: var(--tv-FilterBox-disabled-text-color);
- fill: #b5bbc1;
+ fill: var(--tv-FilterBox-disabled-icon-color); Define these new variables in Also applies to: 109-109 |
||
.title label { | ||
color: #b5bbc1; | ||
color: var(--tv-FilterBox-btn-disabled-text-color); | ||
} | ||
|
||
.value { | ||
color: #5c6976; | ||
color: var(--tv-FilterBox-btn-disabled-text-color); | ||
} | ||
|
||
svg.filter-box-icon { | ||
fill: #b5bbce; | ||
fill: var(--tv-FilterBox-icon-color-disabled); | ||
cursor: not-allowed; | ||
} | ||
} | ||
|
||
.title { | ||
height: inherit; | ||
line-height: var(--ti-filter-box-btn-title-line-height); | ||
font-size: var(--ti-filter-box-btn-font-size); | ||
/* TODO: title 这个类名不符合组件类名规范,被公共样式污染,故在此处重置间距为 0.计划优化这个类名 */ | ||
margin-right: 0px; | ||
line-height: var(--tv-FilterBox-btn-title-line-height); | ||
font-size: var(--tv-FilterBox-btn-font-size); | ||
margin-right: 0; | ||
|
||
label { | ||
display: inline-block; | ||
max-width: 100px; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
color: var(--ti-filter-box-btn-text-color); | ||
color: var(--tv-FilterBox-btn-text-color); | ||
margin-right: 8px; | ||
margin-top: 3px; | ||
} | ||
|
||
&.active label { | ||
color: var(--ti-filter-box-btn-hover-text-color); | ||
color: var(--tv-FilterBox-btn-active-text-color); | ||
} | ||
|
||
// 问号图标 | ||
svg { | ||
width: 16px; | ||
height: 16px; | ||
margin-right: var(--ti-filter-box-help-btn-margin-right); | ||
fill: var(--ti-filter-box-help-btn-icon-color); | ||
width: var(--tv-FilterBox-icon-size); | ||
height: var(--tv-FilterBox-icon-size); | ||
margin-right: var(--tv-FilterBox-help-btn-margin-right); | ||
fill: var(--tv-FilterBox-icon-color); | ||
position: relative; | ||
top: var(--ti-filter-box-help-btn-position-top); | ||
top: var(--tv-FilterBox-help-btn-position-top); | ||
vertical-align: super; | ||
|
||
&:hover { | ||
fill: var(--ti-filter-box-btn-hover-text-color); | ||
fill: var(--tv-FilterBox-icon-color-hover); | ||
} | ||
} | ||
} | ||
|
||
.value { | ||
max-width: 100px; | ||
height: inherit; | ||
line-height: 1.5; | ||
margin-right: 4px; | ||
vertical-align: middle; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
font-size: 12px; | ||
color: #161e26; | ||
font-size: var(--tv-FilterBox-btn-font-size); | ||
color: var(--tv-color-text); | ||
|
||
&.placeholder { | ||
color: #aeaeae; | ||
color: var(--tv-FilterBox-btn-text-color-placeholder); | ||
} | ||
} | ||
|
||
.filter-box-icon { | ||
width: var(--ti-filter-box-expand-btn-icon-size); | ||
height: var(--ti-filter-box-expand-btn-icon-size); | ||
width: var(--tv-FilterBox-icon-size); | ||
height: var(--tv-FilterBox-icon-size); | ||
cursor: pointer; | ||
fill: var(--ti-filter-box-expand-btn-icon-color); | ||
fill: var(--tv-FilterBox-icon-color); | ||
transition: transform 0.3s; | ||
|
||
&.is-reverse { | ||
transform: rotate(180deg); | ||
} | ||
} | ||
|
||
&:hover { | ||
.filter-box-icon { | ||
fill: var(--ti-filter-box-expand-btn-icon-color-hover); | ||
} | ||
} | ||
|
||
.filter-icon-close { | ||
width: 16px; | ||
height: 16px; | ||
width: var(--tv-FilterBox-icon-size); | ||
height: var(--tv-FilterBox-icon-size); | ||
cursor: pointer; | ||
fill: #b5bbc1; | ||
fill: var(--tv-FilterBox-icon-color); | ||
|
||
&:hover { | ||
fill: #78828d; | ||
fill: var(--tv-FilterBox-icon-color-hover); | ||
} | ||
} | ||
|
||
&:not(.disabled):hover { | ||
background: var(--tv-FilterBox-btn-hover-bg-color); | ||
|
||
.filter-box-icon { | ||
fill: var(--tv-FilterBox-icon-color-hover); | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Consider the trade-offs of the new selector approach
The change from
page.getByRole('radio', { name: '等于' }).click()
topage.locator('label').filter({ hasText: '等于' }).click()
has both advantages and potential drawbacks:Pros:
Cons:
While the new approach works, it's generally recommended to use role-based selectors when possible for better accessibility testing. Consider using a data attribute for more specific targeting:
This approach combines specificity with maintainability. If you decide to keep the current implementation, please ensure it's consistently applied across all similar scenarios in the test suite.