Skip to content

fix(popconfirm): [popconfirm] Adapt to dark themes #3201

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

Merged
merged 2 commits into from
Mar 28, 2025
Merged

Conversation

Youyou-smiles
Copy link
Collaborator

@Youyou-smiles Youyou-smiles commented Mar 27, 2025

fix(popconfirm): [popconfirm] Adapt to dark themes

Summary by CodeRabbit

  • Style
    • Updated popconfirm arrow styling, shifting from a border effect to a solid background color for a cleaner appearance.
    • Enhanced popconfirm footer buttons by adding a round attribute for a more modern look.
    • Enabled custom icon styling via configurable classes to allow tailored visual customization.

Copy link

coderabbitai bot commented Mar 27, 2025

Walkthrough

This update refactors the visual styling of popconfirm components across several demo files and the core component. The changes remove CSS rules that targeted pseudo-elements for the popper arrow, replacing them with direct background-color styling. Additionally, the popconfirm footers have been updated to include a round attribute on buttons, and a custom class with its associated styling has been added for enhanced icon customization. No functional changes or modifications to exported entities were made.

Changes

File(s) Change Summary
examples/.../popconfirm/custom-class-composition-api.vue
examples/.../popconfirm/custom-class.vue
Removed the ::after pseudo-element rule setting border-top-color: #ccc; added a rule applying background-color: #ccc directly to .popper__arrow.
examples/.../popconfirm/slot-footer-composition-api.vue
examples/.../popconfirm/slot-footer.vue
packages/vue/src/popconfirm/src/pc.vue
Added the round attribute to <tiny-button> elements in the popconfirm footer to adjust button appearance.
examples/.../popconfirm/type-composition-api.vue
examples/.../popconfirm/type.vue
Introduced the custom-class="custom-icon" attribute to <tiny-popconfirm> and a new CSS block for .custom-icon svg to set its fill color.

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • zzcr

Poem

In a garden of code, I hop with delight,
Adjusting arrows with hues so bright.
Round buttons gleam under the moon’s soft glow,
Styling refined, as the gentle winds blow.
A rabbit’s cheer for changes made right! 🐰✨

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/popconfirm/custom-class-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/popconfirm/type-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/popconfirm/slot-footer.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.

  • 4 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 8c8ea33 and 57636f8.

📒 Files selected for processing (7)
  • examples/sites/demos/pc/app/popconfirm/custom-class-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/popconfirm/custom-class.vue (1 hunks)
  • examples/sites/demos/pc/app/popconfirm/slot-footer-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/popconfirm/slot-footer.vue (1 hunks)
  • examples/sites/demos/pc/app/popconfirm/type-composition-api.vue (2 hunks)
  • examples/sites/demos/pc/app/popconfirm/type.vue (2 hunks)
  • packages/vue/src/popconfirm/src/pc.vue (1 hunks)
🔇 Additional comments (10)
examples/sites/demos/pc/app/popconfirm/slot-footer-composition-api.vue (1)

8-8: Good enhancement for button styling consistency.

Adding the round attribute to the button enhances the visual appearance and makes it more consistent with modern UI practices. This change aligns well with the PR objective of adapting the popconfirm component to dark themes, where rounded corners often provide better visual contrast.

examples/sites/demos/pc/app/popconfirm/slot-footer.vue (1)

8-8: Good enhancement for button styling consistency.

Adding the round attribute to the button improves visual appearance and maintains consistency with the composition API version of this demo. This styling adjustment helps with the PR's goal of better dark theme adaptation.

examples/sites/demos/pc/app/popconfirm/custom-class.vue (1)

33-34: Improved arrow styling for theme compatibility.

Switching from pseudo-element border styling to direct background-color on the arrow element is a good approach for theme compatibility. This change simplifies the styling and ensures that the arrow color will properly match the popover background in various theme contexts, including dark themes.

examples/sites/demos/pc/app/popconfirm/custom-class-composition-api.vue (1)

24-25: Improved arrow styling for theme compatibility.

The direct background-color application to the arrow element improves theme compatibility and maintains consistency with the Options API version. This approach works better for dark themes as it ensures the arrow properly integrates with the popover background.

examples/sites/demos/pc/app/popconfirm/type.vue (2)

27-27: Good approach for theme adaptability!

Adding the custom-class attribute allows for proper styling of the custom icon in different themes. This will help the popconfirm component adapt to dark themes by applying theme-specific styling.


64-68: Excellent use of CSS variables for theme compatibility

Using the CSS variable --tv-color-icon-active for the SVG fill ensures the icon color will automatically adapt to both light and dark themes. This is a good practice for theme-agnostic components.

Note that this style block is intentionally not scoped, which is appropriate since popconfirm components are typically rendered at the document root level.

packages/vue/src/popconfirm/src/pc.vue (2)

34-42: Enhanced button styling with round attribute

Adding the round attribute to the cancel button improves the visual consistency and modern appearance of the popconfirm component, which is particularly beneficial in dark themes where visual separation is important.

The code restructuring from single-line to multi-line also improves readability without changing functionality.


43-51: Consistent styling applied to confirm button

Similarly, the confirm button now has the round attribute for visual consistency with the cancel button. This ensures both buttons have the same shape treatment, creating a more cohesive UI that adapts well to both light and dark themes.

examples/sites/demos/pc/app/popconfirm/type-composition-api.vue (2)

27-27: Good consistency with Options API counterpart

Adding the custom-class attribute here maintains parity with the Options API example, ensuring that both API styles demonstrate the same dark theme adaptation technique.


55-59: Consistent styling implementation

The CSS implementation is identical to the Options API example, which is excellent for documentation consistency. Using --tv-color-icon-active CSS variable ensures the icon will adapt to both light and dark themes automatically.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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.

@github-actions github-actions bot added bug Something isn't working enhancement New feature or request (功能增强) labels Mar 27, 2025
@zzcr zzcr merged commit 0875130 into dev Mar 28, 2025
4 of 5 checks passed
@kagol kagol removed the enhancement New feature or request (功能增强) label Mar 31, 2025
@coderabbitai coderabbitai bot mentioned this pull request Apr 3, 2025
13 tasks
@kagol kagol deleted the lty/feat-popconfirm branch April 14, 2025 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants