-
Notifications
You must be signed in to change notification settings - Fork 279
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(swicth): [switch]refactor switch theme #2183
Conversation
WalkthroughThe changes in this pull request involve updates to the switch component's styling and testing. The test case for the switch button has been simplified by removing assertions related to 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: 1
🧹 Outside diff range and nitpick comments (2)
packages/theme/src/switch/vars.less (2)
56-57
: Fix the typo in the commentThere is a typographical error in the comment: "宽度度" repeats the character "度". Please correct it to "宽度".
Suggested change:
-// mini尺寸内部button宽度度 +// mini尺寸内部button宽度
58-59
: Update the comment to match the variableThe comment at line 58 does not accurately describe the variable
--tv-Switch-mini-button-left
at line 59. It appears to be duplicated from the previous comment and should be updated to reflect that this variable sets the left offset of the mini button.Suggested change:
-// mini尺寸内部button宽度度 +// mini尺寸内部button左边距
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
- examples/sites/demos/pc/app/switch/basic-usage.spec.ts (0 hunks)
- packages/theme/src/switch/index.less (2 hunks)
- packages/theme/src/switch/vars.less (1 hunks)
💤 Files not reviewed due to no reviewable changes (1)
- examples/sites/demos/pc/app/switch/basic-usage.spec.ts
🔇 Additional comments not posted (3)
packages/theme/src/switch/index.less (3)
86-87
: Consistency in selector syntaxThe selector
&&-checked.disabled
may be incorrect. Double ampersands&&
are used to reference the parent selector in LESS. Please verify that this selector is intended or if it should be corrected to maintain consistent styling.Consider reviewing the selector for potential syntax issues.
Line range hint
22-129
: Verify all CSS variable prefixes updated from--ti-
to--tv-
Ensure that all CSS variables have been updated from the
--ti-
prefix to the--tv-
prefix to maintain consistency and avoid referencing undefined variables.Run the following script to check for any remaining
--ti-
variable references:#!/bin/bash # Description: Search for any occurrences of `--ti-` variables. # Expected result: No output if all instances have been updated. rg --type less '--ti-'
19-19
: Ensure.inject-Switch-vars()
mixin is defined and importedPlease verify that the mixin
.inject-Switch-vars()
is properly defined and imported. This ensures that all necessary variables are injected correctly into the switch component.Run the following script to check for the definition of
.inject-Switch-vars()
:✅ Verification successful
.inject-Switch-vars()
mixin is properly defined and imported
- Defined in
packages/theme/src/switch/vars.less
- Imported in
packages/theme/src/switch/index.less
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Search for the definition of `.inject-Switch-vars()` # Expected result: Lines showing where the mixin is defined. rg --type less $'.inject-Switch-vars()'Length of output: 524
Script:
#!/bin/bash # Description: Search for the definition of `.inject-Switch-vars()` in .less files # Expected result: Lines showing where the mixin is defined. rg -g "*.less" "\.inject-Switch-vars\(\)"Length of output: 165
Script:
#!/bin/bash # Description: Verify that `vars.less` is imported in `index.less` # Expected result: Lines showing import statements for `vars.less` in `index.less` rg '@import\s+["'\''].*vars\.less["'\'']' packages/theme/src/switch/index.lessLength of output: 103
@@ -10,58 +10,61 @@ | |||
* | |||
*/ | |||
|
|||
.component-css-vars-switch() { | |||
.inject-Switch-vars() { |
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.
💡 Codebase verification
Old mixin .component-css-vars-switch()
references remain in the codebase
packages/theme-mobile/src/switch/vars.less
:.component-css-vars-switch() {
packages/theme-mobile/src/switch/index.less
:.component-css-vars-switch();
🔗 Analysis chain
Ensure all references to the old mixin name are updated
The mixin name has been changed from .component-css-vars-switch()
to .inject-Switch-vars()
. Please verify that all references to the old mixin name are updated throughout the codebase to prevent any build or styling issues.
You can run the following script to check for any remaining references:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Search for occurrences of the old mixin name `.component-css-vars-switch()`
# Test: Expect no matches for the old mixin name
rg --type less '\.component-css-vars-switch\(\)'
Length of output: 200
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
Documentation