-
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(popconfirm): [popconfirm] refactor theme vars #2282
Conversation
WalkthroughThe changes in this pull request focus on the Changes
Possibly related PRs
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (2)
packages/theme/src/popconfirm/vars.less (1)
15-40
: Standardize CSS variable naming conventionWhile the prefix
--tv-Popconfirm-
is consistently used, there's an inconsistency in the naming convention for the rest of the variable names. Some use kebab-case (e.g.,popover-title-line-height
), while others use camelCase (e.g.,popoverTitleLineHeight
). It's recommended to standardize this for better maintainability and consistency.Consider using kebab-case for all variable names, as it's more common in CSS. For example:
--tv-Popconfirm-popover-title-line-height --tv-Popconfirm-popover-content-line-height --tv-Popconfirm-popover-footer-font-size // ... and so onpackages/theme/src/popconfirm/index.less (1)
48-51
: Approve icon styling updates and suggest documentation review.The addition of fixed dimensions for the icon (20px x 20px) ensures consistent sizing, while the use of CSS variables for margins improves customizability. These changes enhance both the consistency and flexibility of the component.
Consider updating the component documentation to reflect these new styling options, particularly the ability to customize icon margins through CSS variables.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (2)
- packages/theme/src/popconfirm/index.less (3 hunks)
- packages/theme/src/popconfirm/vars.less (1 hunks)
🧰 Additional context used
🔇 Additional comments (14)
packages/theme/src/popconfirm/vars.less (8)
13-13
: LGTM: Improved function namingThe function name change from
.component-css-vars-popconfirm()
to.inject-Popconfirm-vars()
is a good improvement. It's more descriptive and consistent with the component name.
15-17
: LGTM: Consistent line height variablesThe changes to the title and content line height variables are good. They now follow the new naming convention and use a consistent value
var(--tv-line-height-number)
.
19-21
: LGTM: Improved font size and color variablesThe updates to footer font size and color variables are good. They now use global theme variables, which improves consistency and makes future theme changes easier.
23-28
: LGTM: Consistent spacing variablesThe changes to padding and margin variables are good. They now follow the new naming convention and use global spacing variables, which improves consistency across the theme.
30-32
: LGTM: Improved title style variablesThe updates to title style variables (font size, weight, and color) are good. They now use global theme variables, which improves consistency and makes future theme changes easier.
34-35
: LGTM: Updated margin variables and new confirm button marginThe changes to margin variables are good. They now follow the new naming convention and use global spacing variables. The addition of
--tv-Popconfirm-popover-confirm-button-margin-left
is a nice improvement for more granular control over the layout.
37-40
: LGTM: New icon fill color variablesThe addition of icon fill color variables for different states (info, error, warning, success) is a great improvement. This allows for more granular control over the appearance of icons and ensures consistency with the global color scheme.
13-40
: Verify impact of variable renaming across the codebaseThe extensive renaming of variables from
--ti-
to--tv-
prefix and the changes in referenced global theme variables may have a widespread impact on the codebase. It's crucial to ensure that all references to these variables are updated accordingly.Please run the following script to identify any remaining references to the old variable names:
This will help identify any places where the old variable names are still in use and need to be updated.
✅ Verification successful
Please run the following updated script to accurately search for old and new variable names across
.less
,.js
, and.vue
files:
Variable renaming fully verified
No remaining references to the old variable names (
--ti-popconfirm
) were found. All references have been successfully updated to--tv-Popconfirm
.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Search for any remaining references to old variable names # Test: Search for old variable names echo "Searching for old variable names..." rg --type less --type vue --type js '\-\-ti\-popconfirm' # Test: Verify new variable usage echo "Verifying new variable usage..." rg --type less --type vue --type js '\-\-tv\-Popconfirm' echo "Please review the results and update any remaining references to old variable names."Length of output: 506
Script:
#!/bin/bash # Description: Search for any remaining references to old and verify new variable names # Search for old variable names echo "Searching for old variable names..." rg '\-\-ti\-popconfirm' -g '*.less' -g '*.js' -g '*.vue' # Verify new variable usage echo "Verifying new variable usage..." rg '\-\-tv\-Popconfirm' -g '*.less' -g '*.js' -g '*.vue' echo "Please review the results and update any remaining references to old variable names."Length of output: 4011
packages/theme/src/popconfirm/index.less (6)
44-44
: Approve margin-bottom variable update.The change to use a CSS variable for the margin-bottom property of the popconfirm header is consistent with the new naming convention and improves the component's customizability.
55-57
: Approve title and content styling variable updates.The transition to using CSS variables with the
tv-
prefix for all title and content styling properties is consistent with the new naming convention. This change enhances the component's customizability and maintains a uniform approach to styling across the component.Also applies to: 61-62
72-72
: Approve confirm button margin update.The use of a CSS variable for the
margin-left
property of the confirm button is consistent with the new naming convention and improves the component's customizability.
20-20
: Approve mixin renaming and suggest usage verification.The mixin renaming from
.component-css-vars-popconfirm()
to.inject-Popconfirm-vars()
improves clarity and consistency. This change aligns with best practices for naming conventions.To ensure this change doesn't break any existing imports or usage, please run the following script:
✅ Verification successful
Mixin renaming verified successfully.
The old mixin
component-css-vars-popconfirm
is no longer present in the codebase, and the new mixininject-Popconfirm-vars
is used consistently in the following files:
packages/theme/src/popconfirm/vars.less
packages/theme/src/popconfirm/index.less
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of the renamed mixin across the codebase. # Test: Search for any remaining usage of the old mixin name rg --type less "component-css-vars-popconfirm" # Test: Confirm the new mixin name is used consistently rg --type less "inject-Popconfirm-vars"Length of output: 294
81-81
: Approve icon fill color updates and suggest theme consistency check.The transition to using CSS variables with the
tv-
prefix for all icon fill colors is consistent with the new naming convention. This change enhances the component's customizability for different states (info, error, warning, success).To ensure color consistency across different themes, please run the following script:
Also applies to: 85-85, 89-89, 93-93
✅ Verification successful
Icon fill color updates verified successfully.
All
fill
properties inpackages/theme/src/popconfirm/index.less
now consistently use thetv-
prefixed CSS variables. This standardization ensures enhanced customizability and maintains consistency across different states (info, error, warning, success).🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the consistency of icon fill colors across themes. # Test: Check the values assigned to these variables in different theme files rg --type less "tv-Popconfirm-icon-(info|error|warning|success)-fill"Length of output: 2149
Script:
#!/bin/bash # Description: Verify the consistency of icon fill colors across all theme files. # Search for the usage of the new tv-Popconfirm-icon-* fill variables in all .less files rg --type less "var\(--tv-Popconfirm-icon-(info|error|warning|success)-fill\)" packages/theme/src/Length of output: 459
36-38
: Approve CSS variable renaming and suggest comprehensive check.The update of CSS variable names from
ti-
prefix totv-
prefix for the popover container styling improves consistency across the component library. This change aligns with the new naming convention while maintaining the same styling functionality.To ensure all variables have been updated consistently, please run the following script:
✅ Verification successful
CSS variable renaming verified successfully.
All instances of
ti-
prefixed variables have been removed, and thetv-
prefix is used consistently across thepopconfirm
package. The renaming enhances consistency within the component library without affecting styling functionality.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the consistent usage of the new CSS variable prefix. # Test: Search for any remaining `ti-` prefixed variables in this file rg --type less "var\(--ti-" packages/theme/src/popconfirm/index.less # Test: Confirm the new `tv-` prefix is used consistently rg --type less "var\(--tv-" packages/theme/src/popconfirm/index.lessLength of output: 2149
Script:
#!/bin/bash # Description: Verify the absence of `ti-` prefixed variables and confirm consistent usage of `tv-` prefixes in the popconfirm package. # Test 1: Search for any remaining `ti-` prefixed variables in the popconfirm package rg --type less "var\(--ti-" packages/theme/src/popconfirm/ # Test 2: Confirm the consistent usage of `tv-` prefixes across the popconfirm package rg --type less "var\(--tv-" packages/theme/src/popconfirm/Length of output: 3682
justify-content: right; | ||
margin-top: var(--tv-Popconfirm-popover-footer-margin-top); |
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.
Approve margin-top update, but justify-content
value needs correction.
The use of a CSS variable for margin-top
is consistent with the new naming convention and improves customizability. However, the justify-content
property has an invalid value.
The justify-content: right
is not a valid CSS value. Please update it to a valid value, such as flex-end
or end
. Here's the suggested fix:
- justify-content: right;
+ justify-content: flex-end;
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
justify-content: right; | |
margin-top: var(--tv-Popconfirm-popover-footer-margin-top); | |
justify-content: flex-end; | |
margin-top: var(--tv-Popconfirm-popover-footer-margin-top); |
--tv-Popconfirm-icon-info-fill: var(--tv-color-info-text); | ||
--tv-Popconfirm-icon-error-fill: var(--tv-color-error-text); | ||
--tv-Popconfirm-icon-warning-fill: var(--tv-color-warning-text); | ||
--tv-Popconfirm-icon-success-fill: var(--tv-color-success-text); |
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.
以上四个明明图标填充色,为啥要用字体颜色呢?改成:--tv-color-info-icon、--tv-color-error-icon、--tv-color-warn-icon、--tv-color-success-icon
PR
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information
Summary by CodeRabbit
New Features
Bug Fixes