-
Notifications
You must be signed in to change notification settings - Fork 330
fix(switch): modify the saas theme style #3773
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
Changes from all commits
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 | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -27,32 +27,50 @@ | |||||||||||||||||||||||||||||||||||||
| width: 38px; | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| &&-checked.disabled, | ||||||||||||||||||||||||||||||||||||||
| &.disabled { | ||||||||||||||||||||||||||||||||||||||
| @apply cursor-not-allowed; | ||||||||||||||||||||||||||||||||||||||
| @apply bg-color-text-disabled; | ||||||||||||||||||||||||||||||||||||||
| @apply border-color-text-primary; | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| &&-checked.disabled { | ||||||||||||||||||||||||||||||||||||||
| @apply bg-color-brand-disabled; | ||||||||||||||||||||||||||||||||||||||
| &&-checked &__button { | ||||||||||||||||||||||||||||||||||||||
| left: calc(100% - 18px); | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| &::after { | ||||||||||||||||||||||||||||||||||||||
| @apply content-['']; | ||||||||||||||||||||||||||||||||||||||
| &__button { | ||||||||||||||||||||||||||||||||||||||
| @apply w-4; | ||||||||||||||||||||||||||||||||||||||
| @apply h-4; | ||||||||||||||||||||||||||||||||||||||
| @apply flex; | ||||||||||||||||||||||||||||||||||||||
| @apply items-center; | ||||||||||||||||||||||||||||||||||||||
| @apply justify-center; | ||||||||||||||||||||||||||||||||||||||
| border-radius: 50%; | ||||||||||||||||||||||||||||||||||||||
| @apply content-['']; | ||||||||||||||||||||||||||||||||||||||
| @apply ~'top-0.5'; | ||||||||||||||||||||||||||||||||||||||
| @apply ~'left-0.5'; | ||||||||||||||||||||||||||||||||||||||
| @apply rounded-full; | ||||||||||||||||||||||||||||||||||||||
| @apply bg-color-bg-1; | ||||||||||||||||||||||||||||||||||||||
| @apply absolute; | ||||||||||||||||||||||||||||||||||||||
| @apply ~'left-0.5'; | ||||||||||||||||||||||||||||||||||||||
| @apply ~'translate-y-0.5'; | ||||||||||||||||||||||||||||||||||||||
| @apply cursor-pointer; | ||||||||||||||||||||||||||||||||||||||
| transition: left 0.2s ease-in-out, width 0.2s ease-in-out; | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| &:not(.disabled)::after { | ||||||||||||||||||||||||||||||||||||||
| @apply shadow-xsm; | ||||||||||||||||||||||||||||||||||||||
| &&-checked.disabled, | ||||||||||||||||||||||||||||||||||||||
| &.disabled { | ||||||||||||||||||||||||||||||||||||||
| @apply cursor-not-allowed; | ||||||||||||||||||||||||||||||||||||||
| background-color: #dbdbdb; | ||||||||||||||||||||||||||||||||||||||
| border-color: #dbdbdb; | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| &&-checked.disabled { | ||||||||||||||||||||||||||||||||||||||
| @apply bg-color-brand-disabled; | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| &__on-loading { | ||||||||||||||||||||||||||||||||||||||
| @apply text-xs; | ||||||||||||||||||||||||||||||||||||||
| fill: #b3d6ff; | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| &__off-loading { | ||||||||||||||||||||||||||||||||||||||
| @apply text-xs; | ||||||||||||||||||||||||||||||||||||||
| fill: #dbdbdb; | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+62
to
+70
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 | 🟠 Major Replace hardcoded colors with design tokens. The loading states use hardcoded color values ( &__on-loading {
@apply text-xs;
- fill: #b3d6ff;
+ fill: var(--tv-color-brand-light);
}
&__off-loading {
@apply text-xs;
- fill: #dbdbdb;
+ fill: var(--tv-color-bg-disabled);
}Note: Adjust the token names to match your actual design system tokens. The example uses common naming patterns, but you should verify the correct token names in your theme configuration. 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| &__text { | ||||||||||||||||||||||||||||||||||||||
| width: 50px; | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| &&-checked { | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -64,9 +82,5 @@ | |||||||||||||||||||||||||||||||||||||
| width: calc(~'100% - 25px'); | ||||||||||||||||||||||||||||||||||||||
| @apply overflow-hidden; | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| &:after { | ||||||||||||||||||||||||||||||||||||||
| left: calc(~'100% - 18px'); | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -33,7 +33,7 @@ export const switchProps = { | |||||||||||
| }, | ||||||||||||
| showText: { | ||||||||||||
| type: Boolean || undefined, | ||||||||||||
| default: undefined | ||||||||||||
| default: false | ||||||||||||
|
Comment on lines
35
to
+36
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. Fix incorrect prop type syntax. The type declaration Apply this diff: showText: {
- type: Boolean || undefined,
+ type: Boolean,
default: false
},📝 Committable suggestion
Suggested change
🤖 Prompt for AI AgentsThere 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. 🧩 Analysis chainVerify the default value change doesn't break existing usage. Changing the default from Run the following script to identify all Switch component usages: 🏁 Script executed: #!/bin/bash
# Description: Find all Switch component usages to verify impact of showText default change
# Search for Switch component imports and usage patterns
rg -n --type vue --type ts --type tsx -C3 '\bSwitch\b' -g '!node_modules' -g '!dist' -g '!packages/vue/src/switch'
# Also search for showText prop usage
rg -n --type vue --type ts --type tsx -C3 'showText' -g '!node_modules' -g '!dist' -g '!packages/vue/src/switch'Length of output: 55 I need to regenerate the search script with corrected ripgrep syntax since Vue file types aren't recognized natively. Let me search more broadly: 🏁 Script executed: #!/bin/bash
# Description: Find all Switch component usages - fixed search without vue file type
# Search for Switch imports and usage in all files
rg -n 'Switch' -C3 -g '!node_modules' -g '!dist' -g '!packages/vue/src/switch/src/index.ts'
# Search for showText prop usage in all files
rg -n 'showText' -C3 -g '!node_modules' -g '!dist' -g '!packages/vue/src/switch'Length of output: 188649 Let me examine the actual Switch component definition to verify the current state of the props:The web search didn't return the specific file. Let me directly inspect the Switch component index file: Length of output: 396 Fix default value to preserve designConfig behavior The current Change the default to showText: {
type: [Boolean, undefined],
default: undefined
}This ensures Aurora and Saas themes display text by default while allowing explicit 🤖 Prompt for AI Agents |
||||||||||||
| }, | ||||||||||||
| types: { | ||||||||||||
| type: String | ||||||||||||
|
|
||||||||||||
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.
Replace hardcoded colors with design tokens (recurring issue).
Lines 54–55 (disabled states) and lines 64, 69 (loading states) still use hardcoded hex values (
#dbdbdb,#b3d6ff) instead of design tokens. This was flagged in the previous review and remains unresolved. Design tokens ensure theming consistency and maintainability.Apply this diff to use design tokens:
&&-checked.disabled, &.disabled { @apply cursor-not-allowed; - background-color: #dbdbdb; - border-color: #dbdbdb; + @apply bg-color-bg-disabled; + @apply border-color-border-disabled; } &&-checked.disabled { - @apply bg-color-brand-disabled; + @apply bg-color-bg-disabled; } &__on-loading { @apply text-xs; - fill: #b3d6ff; + fill: var(--tv-color-brand-light); } &__off-loading { @apply text-xs; - fill: #dbdbdb; + fill: var(--tv-color-bg-disabled); }Verify that these design tokens (
bg-color-bg-disabled,border-color-border-disabled,--tv-color-brand-light,--tv-color-bg-disabled) exist in your design system.Also applies to: 62-70
🤖 Prompt for AI Agents