-
Notifications
You must be signed in to change notification settings - Fork 297
fix(card): [card] Style pollution caused by modifying the card component #2910
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
Conversation
WalkthroughThis pull request refines the styling of card-related Vue components and their theme. It updates CSS selectors to use deep selectors for better style penetration, adds new style rules for input elements, and removes an unused input prefix variable and its associated styles from a LESS file. No public API changes were made. Changes
Possibly related PRs
Suggested reviewers
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 ESLint
examples/sites/demos/pc/app/card/card-select-composition-api.vueOops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't find the plugin "eslint-plugin-vue". (The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "".) It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
The plugin "eslint-plugin-vue" was referenced from the config file in ".eslintrc.js » @antfu/eslint-config » @antfu/eslint-config-vue". If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. examples/sites/demos/pc/app/card/card-select.vueOops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't find the plugin "eslint-plugin-vue". (The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "".) It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
The plugin "eslint-plugin-vue" was referenced from the config file in ".eslintrc.js » @antfu/eslint-config » @antfu/eslint-config-vue". If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. 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 (
|
WalkthroughThis pull request addresses a style pollution issue in the card component by removing unwanted CSS styles affecting the input elements. The changes involve deleting specific styles from the Changes
|
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: 0
🧹 Nitpick comments (2)
examples/sites/demos/pc/app/card/card-select-composition-api.vue (1)
165-169
: Consider accessibility implications of input styling.While the styling fixes the border issue, setting
background-color: #fafafa
on inputs might affect contrast ratio and accessibility. Consider:
- Adding a subtle border or box-shadow for better visual distinction
- Ensuring sufficient contrast between input text and background
.card-wrap :deep(.tiny-input__inner) { border: none; border-radius: 6px; background-color: #fafafa; + box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1); }
examples/sites/demos/pc/app/card/card-select.vue (1)
172-179
: Consider extracting duplicated styles to a shared file.These styles are identical to those in
card-select-composition-api.vue
. To improve maintainability and reduce duplication, consider:
- Moving these styles to a shared CSS file
- Importing the shared styles in both components
Example approach:
/* shared/card-select-styles.css */ #smb-card :deep(.tiny-card--small-padding) { padding: 0; } .card-wrap :deep(.tiny-input__inner) { border: none; border-radius: 6px; background-color: #fafafa; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1); }Then in both components:
<style scoped> @import '../shared/card-select-styles.css'; /* component-specific styles... */ </style>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
examples/sites/demos/pc/app/card/card-select-composition-api.vue
(1 hunks)examples/sites/demos/pc/app/card/card-select.vue
(1 hunks)packages/theme/src/card/index.less
(0 hunks)
💤 Files with no reviewable changes (1)
- packages/theme/src/card/index.less
🔇 Additional comments (1)
examples/sites/demos/pc/app/card/card-select-composition-api.vue (1)
162-164
: LGTM! Improved style scoping with :deep selector.The use of
:deep
selector helps prevent style pollution by properly scoping the padding styles to the card component.
card组件index.less文件中修改了input的样式,这里会导致在card组件中使用TinyInput组件input失去边框,因此需要修改。
修改思路是删除index.less文件中的修改input的样式,在相关使用的demo文件中通过穿透的样式去修改input的样式。
Summary by CodeRabbit