-
Notifications
You must be signed in to change notification settings - Fork 276
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 1 commit
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,23 +16,19 @@ | |
@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); | ||
background: var(--tv-FilterBox-btn-bg-color); | ||
color: #161e26; | ||
padding: 4px var(--ti-filter-box-btn-padding-horizontal); | ||
padding: 4px var(--tv-FilterBox-btn-padding-x); | ||
display: flex; | ||
align-items: center; | ||
font-size: 12px; | ||
|
||
&:hover { | ||
background: var(--ti-filter-box-btn-hover-bg-color); | ||
} | ||
|
||
&.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 |
||
|
@@ -52,46 +48,46 @@ | |
|
||
.title { | ||
height: inherit; | ||
line-height: var(--ti-filter-box-btn-title-line-height); | ||
font-size: var(--ti-filter-box-btn-font-size); | ||
line-height: var(--tv-FilterBox-btn-title-line-height); | ||
font-size: var(--tv-FilterBox-btn-font-size); | ||
/* TODO: title 这个类名不符合组件类名规范,被公共样式污染,故在此处重置间距为 0.计划优化这个类名 */ | ||
margin-right: 0px; | ||
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); | ||
margin-right: var(--tv-FilterBox-help-btn-margin-right); | ||
fill: var(--tv-FilterBox-help-btn-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-btn-hover-icon-color); | ||
} | ||
} | ||
} | ||
|
||
.value { | ||
max-width: 100px; | ||
height: inherit; | ||
line-height: 1.5; | ||
margin-right: 4px; | ||
vertical-align: middle; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
|
@@ -104,20 +100,22 @@ | |
} | ||
|
||
.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-expand-btn-icon-size); | ||
height: var(--tv-FilterBox-expand-btn-icon-size); | ||
cursor: pointer; | ||
fill: var(--ti-filter-box-expand-btn-icon-color); | ||
fill: var(--tv-FilterBox-expand-btn-icon-color); | ||
transition: transform 0.3s; | ||
|
||
&.is-reverse { | ||
transform: rotate(180deg); | ||
} | ||
} | ||
|
||
&:hover { | ||
&:not(.disabled):hover { | ||
background: var(--tv-FilterBox-btn-hover-bg-color); | ||
|
||
.filter-box-icon { | ||
fill: var(--ti-filter-box-expand-btn-icon-color-hover); | ||
fill: var(--tv-FilterBox-expand-btn-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 using CSS variables instead of hardcoded color values
The color
#161e26
is hardcoded in the.filter-box
and.value
classes. For consistency and easier theme customization, consider replacing hardcoded colors with theme variables.Apply the following changes:
Ensure that
--tv-FilterBox-text-color
is defined invars.less
with the appropriate value.Also applies to: 94-94