-
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(tabs): [tabs] refactor the Tabs Theme #2270
Conversation
WalkthroughThe changes in this pull request primarily focus on updating the theme configuration and variable naming conventions within the Changes
Possibly related PRs
Suggested reviewers
Poem
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 (7)
packages/theme/src/tabs/old-theme.js (1)
2-2
: Inconsistent capitalization in new key nameThe new key name uses 'Tabs' with a capital 'T', which is different from the old naming convention. Consider using lowercase 'tabs' for consistency with other variable names, unless there's a specific reason for this capitalization.
examples/sites/demos/pc/webdoc/theme-en.md (3)
158-160
: LGTM! Clear examples for manual variable replacement.The new examples for manually replacing CSS variables are clear and helpful. They provide good guidance for users migrating to the new naming convention, especially for complex cases where old variables are split into multiple new ones.
Consider adding a brief introductory sentence before these examples to provide context, such as:
"Here are some examples of how to manually replace variables in different scenarios:"
310-323
: LGTM! New variables added with correct prefix and split components.The new variables
--tv-Tabs-item-active-border
,--tv-Tabs-item-border-bottom
, and--tv-Tabs-icon-close-margin
are correctly added with the new--tv-
prefix. The split components for each variable provide more granular control over styles, which is beneficial for developers.For consistency, consider using the same naming pattern for all split components. For example:
- Change
--tv-Tabs-item-bottom-border-weight
to--tv-Tabs-item-border-bottom-weight
- Change
--tv-Tabs-item-bottom-border-style
to--tv-Tabs-item-border-bottom-style
- Change
--tv-Tabs-item-bottom-border-color
to--tv-Tabs-item-border-bottom-color
This would make the relationship between the main variable and its components more apparent.
Line range hint
1-323
: LGTM! Comprehensive and well-structured theme documentation.The overall structure and content of the theme documentation are excellent. The file provides clear instructions for using predefined themes, customizing themes, and migrating from old to new variable names. The addition of examples and explanations for special cases is particularly helpful.
Consider adding a table of contents at the beginning of the document to help users quickly navigate to specific sections, especially given the length and depth of the content.
packages/theme/src/theme/infinity-theme/component-vars.js (1)
83-103
: Ensure comprehensive update of tab-related variable references.While the changes in this file are clear and improve consistency, they may have a widespread impact on the codebase. To ensure a smooth transition:
- Perform a comprehensive search and replace across the entire codebase to update all references to these variables.
- Update any relevant documentation that mentions these CSS variables.
- If there's a migration guide or changelog, add an entry about this naming convention change.
To assist with the comprehensive update, you can use the following script to generate a list of files that need to be checked:
#!/bin/bash # Description: Generate a list of files that potentially need updating # Search for files containing any of the old variable names rg --type css --type js --type vue --files-with-matches 'ti-tabs-' -g '!packages/theme/src/theme/infinity-theme/component-vars.js' # Search for files containing template strings with the old variable names rg --type js --type vue --files-with-matches "['`\"]ti-tabs-" -g '!packages/theme/src/theme/infinity-theme/component-vars.js'This script will output a list of files that potentially need to be updated. Review each file and update the variable references as necessary.
packages/theme/src/tabs/index.less (2)
Line range hint
756-759
: Update variable prefix from--ti-
to--tv-
.The variable
--ti-common-color-icon-white
should be updated to--tv-common-color-icon-white
to maintain consistency with the new naming convention.Apply this diff to fix the variable prefix:
- fill: var(--ti-common-color-icon-white); + fill: var(--tv-common-color-icon-white);
367-367
: Standardize code comments and remove internal annotations.The code contains comments like
// smb新增
and// aurora新增
. Consider replacing them with more descriptive comments or removing them if they are no longer needed, to improve code readability and maintainability.Also applies to: 373-373, 441-441, 482-482, 519-519, 531-531, 551-551, 681-681
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (8)
- examples/sites/demos/pc/webdoc/theme-en.md (2 hunks)
- examples/sites/src/views/components/components.vue (1 hunks)
- packages/theme/src/bulletin-board/index.less (1 hunks)
- packages/theme/src/tabs/aurora-theme.js (1 hunks)
- packages/theme/src/tabs/index.less (29 hunks)
- packages/theme/src/tabs/old-theme.js (1 hunks)
- packages/theme/src/tabs/vars.less (1 hunks)
- packages/theme/src/theme/infinity-theme/component-vars.js (1 hunks)
✅ Files skipped from review due to trivial changes (1)
- packages/theme/src/bulletin-board/index.less
🧰 Additional context used
🔇 Additional comments (6)
packages/theme/src/tabs/old-theme.js (1)
2-16
: Consistent renaming of theme variablesThe changes in this file show a systematic renaming of all theme variables from the 'ti-' prefix to the 'tv-' prefix. This is consistent with the PR objectives of refactoring the Tabs Theme.
To ensure this change is consistent across the codebase, let's run the following verification:
examples/sites/demos/pc/webdoc/theme-en.md (1)
Line range hint
1-323
: LGTM! Excellent update to the theme configuration documentation.This update to the theme configuration documentation is comprehensive and well-executed. Key improvements include:
- Consistent use of the new
--tv-
prefix for CSS variables in examples.- Clear instructions for using predefined themes and customizing themes.
- Detailed guide for replacing old variable names with new ones, including special cases.
- Addition of helpful examples for manual variable replacement.
These changes will greatly assist developers in working with TinyVue themes and migrating to the new naming conventions.
packages/theme/src/theme/infinity-theme/component-vars.js (1)
83-103
: Approve renaming of tab-related CSS variables for improved consistency.The renaming of tab-related CSS variables from 'ti-tabs-' to 'tv-Tabs-' improves naming consistency across the codebase. This change aligns with the project's refactoring efforts to standardize variable naming conventions.
To ensure these changes don't introduce any regressions, please run the following script to check for any remaining occurrences of the old variable names:
If the script returns any results, those occurrences should be updated to use the new variable names.
✅ Verification successful
Script encountered errors. Generating a corrected script to re-verify the codebase:
All old tab-related CSS variables have been successfully renamed. No remaining occurrences found in the codebase.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for any remaining occurrences of old tab-related variable names # Search for old variable names in CSS, JavaScript, and Vue files rg --type css --type js --type vue 'ti-tabs-' -g '!packages/theme/src/theme/infinity-theme/component-vars.js' # Search for usage of the old variable names in template strings rg --type js --type vue "['`\"]ti-tabs-" -g '!packages/theme/src/theme/infinity-theme/component-vars.js'Length of output: 231
Script:
#!/bin/bash # Description: Check for any remaining occurrences of old tab-related variable names # Search for old variable names in CSS, JavaScript, and Vue files by file extension rg 'ti-tabs-' --glob '!packages/theme/src/theme/infinity-theme/component-vars.js' -g '*.css' -g '*.js' -g '*.vue'Length of output: 113
packages/theme/src/tabs/vars.less (1)
13-179
: Ensure All Variable Prefixes Are Updated from--ti-
to--tv-
While this file has been updated, please verify that all references to the old
--ti-
prefixed variables throughout the codebase have been changed to--tv-
to prevent any mismatches or styling issues.Run the following script to check for any remaining
--ti-
variables:examples/sites/src/views/components/components.vue (1)
776-778
: CSS variables updated correctlyThe CSS variables on lines 776-778 are correctly updated to use the new
--tv-
prefix and have appropriate values.packages/theme/src/tabs/index.less (1)
23-23
: Mixins are correctly applied to inject variables.The
.inject-Tabs-vars();
mixin is appropriately used to include the updated variables. This ensures that all the necessary variables are injected consistently.Also applies to: 27-27
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
--ti-
to--tv-
for consistency across themes.Style
Documentation