Skip to content

fix(button): [button,tag] fix the display problem of the button and tag components in dark mode #2928

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 3 commits into from
Feb 20, 2025

Conversation

shenjunjian
Copy link
Collaborator

@shenjunjian shenjunjian commented Feb 19, 2025

PR

暗黑模式下, 按钮的图标和仅图标不显示的问题
暗黑模式下, tag的plain模式改为透明。

增加tag的demo的样式。 几个demo的样式是通过其它demo污染过来的, 修改为各个demo增加scoped sytle.

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Style
    • Refined spacing for tag displays, enhancing horizontal and vertical balance.
    • Updated button icon styling to ensure consistent, visually appealing colors.
    • Adjusted tag backgrounds across themes to a transparent look for a cleaner, modern design.

@github-actions github-actions bot added the bug Something isn't working label Feb 19, 2025
Copy link

coderabbitai bot commented Feb 19, 2025

Walkthrough

The changes update the styling of various tag components in several demo and theme files. CSS rules have been modified by removing universal margin settings and introducing specific margin styling on the .tiny-tag class. Additionally, the scoped attribute was added to some style blocks to constrain the CSS to its component. New SVG styles for button components were introduced, and CSS variable declarations for plain tag backgrounds were updated to a transparent value.

Changes

File(s) Change Summary
.../tag/color-border-composition-api.vue, .../tag/color-border.vue, .../tag/effect-composition-api.vue, .../tag/effect.vue, .../tag/tag-event-click-composition-api.vue, .../tag/tag-event-click.vue Removed general 8px top/bottom margins and added new 10px right and bottom margins specific to .tiny-tag elements.
.../tag/size-composition-api.vue, .../tag/size.vue Added the scoped attribute to <style> blocks to enforce local styling.
packages/theme/src/button/index.less Introduced new SVG styling for button components, setting fill and color via CSS variables.
packages/theme/src/tag/vars.less Updated CSS variable declarations for plain tag backgrounds across themes to be transparent instead of preset colors.

Possibly related PRs

  • opentiny/tiny-vue#2688: Directly relates to updates in .tiny-tag-demo styling.
  • opentiny/tiny-vue#2163: Involves CSS variable reorganizations that impact tag styling.
  • opentiny/tiny-vue#2624: Contains similar modifications to margin properties for .tiny-tag elements.

Suggested labels

bug

Suggested reviewers

  • zzcr

Poem

I’m a bunny hopping through the code,
Rearranging margins on each node.
Scoped styles keep my fields neat,
SVG hops and tag trends meet.
With transparent hues and styled delight,
I cheer on changes day and night! 🐇

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

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

examples/sites/demos/pc/app/tag/color-border-composition-api.vue

Oops! 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:

npm install eslint-plugin-vue@latest --save-dev

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/tag/color-border.vue

Oops! 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:

npm install eslint-plugin-vue@latest --save-dev

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/tag/effect.vue

Oops! 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:

npm install eslint-plugin-vue@latest --save-dev

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.

  • 5 others

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2fb6814 and 5febde2.

📒 Files selected for processing (10)
  • examples/sites/demos/pc/app/tag/color-border-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/tag/color-border.vue (1 hunks)
  • examples/sites/demos/pc/app/tag/effect-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/tag/effect.vue (1 hunks)
  • examples/sites/demos/pc/app/tag/size-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/tag/size.vue (1 hunks)
  • examples/sites/demos/pc/app/tag/tag-event-click-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/tag/tag-event-click.vue (1 hunks)
  • packages/theme/src/button/index.less (2 hunks)
  • packages/theme/src/tag/vars.less (5 hunks)
✅ Files skipped from review due to trivial changes (6)
  • examples/sites/demos/pc/app/tag/effect.vue
  • examples/sites/demos/pc/app/tag/effect-composition-api.vue
  • examples/sites/demos/pc/app/tag/tag-event-click-composition-api.vue
  • examples/sites/demos/pc/app/tag/tag-event-click.vue
  • examples/sites/demos/pc/app/tag/size.vue
  • examples/sites/demos/pc/app/tag/size-composition-api.vue
🔇 Additional comments (4)
examples/sites/demos/pc/app/tag/color-border-composition-api.vue (1)

24-26: LGTM! Improved tag spacing.

The added margins create consistent spacing between tags, and the scoped attribute prevents style interference with other components.

examples/sites/demos/pc/app/tag/color-border.vue (1)

30-32: LGTM! Consistent with other demo files.

The spacing changes match other demo files, maintaining visual consistency.

packages/theme/src/tag/vars.less (1)

94-94: LGTM! Improved dark mode compatibility.

Setting plain tag backgrounds to transparent across all themes improves visibility in dark mode. The change is consistently applied to all theme variants:

  • Default theme
  • Success theme
  • Danger theme
  • Warning theme
  • Info theme

Also applies to: 113-113, 132-132, 151-151, 170-170

packages/theme/src/button/index.less (1)

329-332: LGTM! Fixed icon display in dark mode.

The changes ensure proper icon visibility in dark mode by:

  1. Setting both fill and color properties for SVG icons
  2. Using the same color variable consistently
  3. Applying changes to both text-only and icon buttons

Also applies to: 368-370


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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

Walkthrough

This PR addresses display issues in dark mode for button and tag components. It fixes the visibility of button icons and changes the plain mode of tags to transparent. Additionally, it updates the tag demo styles to prevent style pollution from other demos by adding scoped styles.

Changes

Files Summary
examples/sites/demos/pc/app/tag/*.vue Updated tag demo styles to use scoped styles and adjusted tag margins.
packages/theme/src/button/index.less Fixed button icon visibility in dark mode by setting fill and color properties.
packages/theme/src/tag/vars.less Changed plain mode background color to transparent for various tag themes.

Copy link

[e2e-test-warn]
The component to be tested is missing.

The title of the Pull request should look like "fix(vue-renderless): [action-menu, alert] fix xxx bug".

Please make sure you've read our contributing guide

@shenjunjian shenjunjian changed the title fix(button): fix the display problem of the button and tag components in dark mode fix(button): [button,tag] fix the display problem of the button and tag components in dark mode Feb 20, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants