-
Notifications
You must be signed in to change notification settings - Fork 281
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(progress): [progress] refactor the progress theme #2234
Conversation
WalkthroughThe changes in this pull request involve the removal of the Changes
Possibly related PRs
Suggested reviewers
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: 6
🧹 Outside diff range and nitpick comments (1)
packages/theme/src/progress/vars.less (1)
13-13
: Ensure consistent naming conventions for mixin functions.The function name has been changed from
.component-css-vars-progress()
to.inject-Progress-vars()
. Consider using a consistent naming convention by using lowercase letters and hyphens, such as.inject-progress-vars()
, to improve readability and maintain consistency across the codebase.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (5)
- packages/theme/src/mixins/progress.less (0 hunks)
- packages/theme/src/progress/aurora-theme.js (1 hunks)
- packages/theme/src/progress/index.less (2 hunks)
- packages/theme/src/progress/old-theme.js (1 hunks)
- packages/theme/src/progress/vars.less (1 hunks)
💤 Files with no reviewable changes (1)
- packages/theme/src/mixins/progress.less
🧰 Additional context used
🔇 Additional comments (5)
packages/theme/src/progress/old-theme.js (5)
2-2
: LGTM: Consistent renaming pattern applied.The key has been renamed from 'ti-progress-exception-bg-color' to 'tv-Progress-bg-color-exception', following a consistent pattern. The value remains unchanged, maintaining the use of the CSS variable.
3-3
: LGTM: Consistent renaming with semantic improvement.The key has been renamed from 'ti-progress-bar-text-margin-left' to 'tv-Progress-right-text-margin-left'. This change not only follows the consistent renaming pattern but also improves the semantic meaning by specifying 'right-text' instead of 'bar-text'.
4-4
: LGTM: Consistent renaming with simplified key.The key has been renamed from 'ti-progress-bar-inner-bg-color' to 'tv-Progress-inner-bg-color'. This change follows the consistent renaming pattern and simplifies the key by removing the redundant 'bar-' prefix.
5-5
: LGTM: Consistent renaming with simplified key.The key has been renamed from 'ti-progress-bar-outer-bg-color' to 'tv-Progress-outer-bg-color'. This change follows the consistent renaming pattern and simplifies the key by removing the redundant 'bar-' prefix.
1-6
: Summary: Consistent theme refactoring with improved naming conventions.The changes in this file demonstrate a systematic refactoring of the progress theme:
- All keys have been renamed from 'ti-progress-' to 'tv-Progress-', improving consistency with the new naming convention.
- The capitalization of 'Progress' in the keys aligns with proper naming conventions for components.
- Some keys have been simplified (e.g., removing redundant 'bar-' prefixes), enhancing clarity.
- All values remain unchanged, preserving the existing theming functionality.
These changes align well with the PR objectives of refactoring the progress theme without introducing functional changes. The new naming convention should improve code readability and maintainability.
c329b5f
to
2ad0c90
Compare
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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (5)
- packages/theme/src/mixins/progress.less (0 hunks)
- packages/theme/src/progress/aurora-theme.js (1 hunks)
- packages/theme/src/progress/index.less (2 hunks)
- packages/theme/src/progress/old-theme.js (1 hunks)
- packages/theme/src/progress/vars.less (1 hunks)
💤 Files with no reviewable changes (1)
- packages/theme/src/mixins/progress.less
🚧 Files skipped from review as they are similar to previous changes (3)
- packages/theme/src/progress/aurora-theme.js
- packages/theme/src/progress/index.less
- packages/theme/src/progress/old-theme.js
🧰 Additional context used
🔇 Additional comments (3)
packages/theme/src/progress/vars.less (3)
13-22
: Excellent refactoring of the progress component variables!The changes in this section demonstrate several improvements:
- The function name
.inject-Progress-vars()
is more descriptive and follows a consistent naming convention.- The use of CSS variables with fallback values (e.g.,
var(--tv-color-bg-gray-2, #e6e6e6)
) enhances theming flexibility while providing default values.- The variable names are clear and self-explanatory, improving code readability.
These changes will make the progress component more maintainable and easier to customize.
34-36
: Well-defined variables for right-side text stylingThe variables for the right-side text margin and color are well-defined and consistent with the overall pattern:
--tv-Progress-right-text-margin-left
uses a spacing variable with a fallback.--tv-Progress-right-text-color
uses a color variable with a fallback.These definitions maintain consistency and flexibility in the theming system.
26-30
:⚠️ Potential issueUse a CSS variable for the exception background color
While the success and warning states use CSS variables with fallback values, the exception state still uses a hard-coded color value. This inconsistency was previously noted but hasn't been addressed.
To maintain consistency and improve theming flexibility, consider updating line 30 as follows:
- --tv-Progress-bg-color-exception: #c7000b; + --tv-Progress-bg-color-exception: var(--tv-color-exception-bg, #c7000b);This change will align the exception state with the pattern used for other states and enhance the overall theming capabilities of the progress component.
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
Refactor