Skip to content

Conversation

@wuyiping0628
Copy link
Collaborator

@wuyiping0628 wuyiping0628 commented Mar 6, 2025

PR

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

    • Enhanced the visual theming of multiple UI components by updating background colors from fixed values to dynamic CSS variables.
    • Refined gradient styling for skeleton items to ensure a more consistent appearance across the application.
  • Chores

    • Streamlined style imports to support centralized theming and simplify future maintenance.

@wuyiping0628 wuyiping0628 added the enhancement New feature or request (功能增强) label Mar 6, 2025
@coderabbitai
Copy link

coderabbitai bot commented Mar 6, 2025

Walkthrough

The changes update the CSS styling across several Vue components and LESS files. In card components, the background color of the .card-wrap class is modified from a fixed hex value (#f5f5f5) to a dynamic CSS variable (var(--tv-color-bg-gray-1)). Similar updates are applied to custom card classes and various theme files, including QR code and skeleton item components. Additional theme variable injections and import statements were added to centralize styling definitions.

Changes

File(s) Summary of Changes
examples/sites/demos/pc/app/card/*.vue (e.g., basic-usage*, card-disabled*, card-events*, card-group*, card-select*, card-size*, card-status*, card-type*, check-mode*, check-type*, slot*, operate-bar*) Updated the background color of the .card-wrap class from a fixed #f5f5f5 to the CSS variable var(--tv-color-bg-gray-1) for dynamic theming and maintainability.
examples/sites/demos/pc/app/card/custom-class*.vue Changed the background color of the .demo-card-custom-class from #f0f0f0 to #f5f5f5, adjusting the component’s visual style.
packages/theme/src/qr-code/index.less, packages/theme/src/qr-code/vars.less, packages/theme/src/skeleton-item/vars.less, packages/theme/src/vars.less Introduced new theme variables and import statements. Added a LESS mixin (.inject-QrCode-vars()) and updated gradient and border definitions for enhanced and centralized styling.
packages/vue/src/qr-code/src/pc.vue Renamed the main container class from tiny-qr-code-container to tiny-qr-code to reflect updated styling conventions.

Possibly related PRs

  • fix(site): document search box adapts to the dark theme. #3046: The changes in the main PR and the retrieved PR are related as both involve modifications to CSS styling, specifically updating selectors to improve theming and maintainability, although they target different classes and contexts.
  • feat(pager): [pager] add dark theme #2987: The changes in the main PR and the retrieved PR are related as both involve modifications to CSS properties, specifically updating background colors from hardcoded values to CSS variables, affecting the same styling approach.
  • fix(site): official website adapts to the dark mode. #2963: The changes in the main PR and the retrieved PR are related as both involve modifications to CSS styling, specifically updating hardcoded color values to CSS variables for the .card-wrap class and other components, enhancing theming and maintainability.

Suggested labels

enhancement

Poem

I'm a hopping rabbit in the code burrow deep,
Updating hues in components while others sleep.
Fixed colors now dance in a variable tune,
A stylish garden blooming under a CSS moon.
With every line refined and themes set free,
CodeRabbit cheers this hop of creativity!

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.

 ERR_PNPM_OPTIONAL_DEPS_REQUIRE_PROD_DEPS  Optional dependencies cannot be installed without production dependencies


📜 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 314b60e and f18dc6f.

📒 Files selected for processing (4)
  • examples/sites/demos/pc/app/qr-code/basic-usage.spec.ts (1 hunks)
  • examples/sites/demos/pc/app/qr-code/icon.spec.ts (1 hunks)
  • examples/sites/demos/pc/app/qr-code/level.spec.ts (1 hunks)
  • examples/sites/demos/pc/app/qr-code/style.spec.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: PR E2E Test (pnpm test:e2e3)
🔇 Additional comments (4)
examples/sites/demos/pc/app/qr-code/basic-usage.spec.ts (1)

7-7: Selector updated to match component structure changes

The selector has been correctly updated from .tiny-qr-code-container canvas to .tiny-qr-code canvas to align with the component's class name changes implemented for dark theme support.

examples/sites/demos/pc/app/qr-code/level.spec.ts (1)

7-7: Selector updated to match component structure changes

The selector has been correctly updated from .tiny-qr-code-container canvas to .tiny-qr-code canvas to align with the component's class name changes implemented for dark theme support.

examples/sites/demos/pc/app/qr-code/icon.spec.ts (1)

7-8: Selector updated to match component structure changes

The canvas selector has been correctly updated from .tiny-qr-code-container canvas to .tiny-qr-code canvas to align with the component's class name changes implemented for dark theme support. The canvasImg selector already used the .tiny-qr-code class, so it required minimal changes.

examples/sites/demos/pc/app/qr-code/style.spec.ts (1)

7-7: Selector updated to match component structure changes

The selector has been correctly updated from .tiny-qr-code-container canvas to .tiny-qr-code canvas to align with the component's class name changes implemented for dark theme support.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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 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 and removed enhancement New feature or request (功能增强) labels Mar 6, 2025
@petercat-assistant
Copy link

Walkthrough

This PR introduces a dark theme for card, QR code, and skeleton components. It replaces hardcoded background colors with CSS variables to support theme customization. Additionally, it updates the QR code component's styles and imports a new variables file for QR code styling.

Changes

Files Summary
examples/sites/demos/pc/app/card/*.vue Replaced hardcoded background colors with CSS variables for dark theme support.
packages/theme/src/qr-code/index.less Updated QR code styles to use CSS variables and added new styles for dark theme.
packages/theme/src/qr-code/vars.less Introduced new CSS variables for QR code component.
packages/theme/src/skeleton-item/vars.less Updated skeleton item gradient colors to use CSS variables.
packages/theme/src/vars.less Imported new QR code variables file.
packages/vue/src/qr-code/src/pc.vue Modified QR code component class name for consistency.

Copy link

@coderabbitai coderabbitai bot left a 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)
packages/theme/src/qr-code/index.less (2)

22-25: Consider using theme variables for border color

While the update to a more transparent border is good, consider using a theme variable for the border color as well to ensure complete theme compatibility.

&.border {
-  border: 1px solid rgba(231, 220, 220, 0.06);
+  border: 1px solid var(--tv-color-border-light);
  border-radius: 8px;
}

37-67: Well-structured mask implementation

The mask implementation is well-organized and properly uses flexbox for centering. The transparent colors should work well in both light and dark themes.

One minor suggestion: consider using CSS variables for the mask background colors to ensure they adapt correctly to themes.

&-status {
  z-index: 20;
-  background: rgb(255 255 255 / 96%);
+  background: var(--tv-color-bg-mask);
}

.icon {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
-  background: white;
+  background: var(--tv-color-bg);
}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 09fef37 and 314b60e.

📒 Files selected for processing (33)
  • examples/sites/demos/pc/app/card/basic-usage-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/card/basic-usage.vue (1 hunks)
  • examples/sites/demos/pc/app/card/card-disabled-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/card/card-disabled.vue (1 hunks)
  • examples/sites/demos/pc/app/card/card-events-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/card/card-events.vue (1 hunks)
  • examples/sites/demos/pc/app/card/card-group-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/card/card-group.vue (1 hunks)
  • examples/sites/demos/pc/app/card/card-select-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/card/card-select.vue (1 hunks)
  • examples/sites/demos/pc/app/card/card-size-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/card/card-size.vue (1 hunks)
  • examples/sites/demos/pc/app/card/card-status-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/card/card-status.vue (1 hunks)
  • examples/sites/demos/pc/app/card/card-type-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/card/card-type.vue (1 hunks)
  • examples/sites/demos/pc/app/card/check-mode-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/card/check-mode.vue (1 hunks)
  • examples/sites/demos/pc/app/card/check-type-checkbox-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/card/check-type-checkbox.vue (1 hunks)
  • examples/sites/demos/pc/app/card/check-type-radio-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/card/check-type-radio.vue (1 hunks)
  • examples/sites/demos/pc/app/card/custom-class-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/card/custom-class.vue (1 hunks)
  • examples/sites/demos/pc/app/card/operate-bar-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/card/operate-bar.vue (1 hunks)
  • examples/sites/demos/pc/app/card/slot-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/card/slot.vue (1 hunks)
  • packages/theme/src/qr-code/index.less (1 hunks)
  • packages/theme/src/qr-code/vars.less (1 hunks)
  • packages/theme/src/skeleton-item/vars.less (1 hunks)
  • packages/theme/src/vars.less (1 hunks)
  • packages/vue/src/qr-code/src/pc.vue (1 hunks)
✅ Files skipped from review due to trivial changes (22)
  • examples/sites/demos/pc/app/card/custom-class-composition-api.vue
  • examples/sites/demos/pc/app/card/card-select-composition-api.vue
  • examples/sites/demos/pc/app/card/card-type-composition-api.vue
  • examples/sites/demos/pc/app/card/card-events.vue
  • examples/sites/demos/pc/app/card/card-disabled-composition-api.vue
  • packages/theme/src/qr-code/vars.less
  • examples/sites/demos/pc/app/card/card-select.vue
  • examples/sites/demos/pc/app/card/card-events-composition-api.vue
  • examples/sites/demos/pc/app/card/custom-class.vue
  • examples/sites/demos/pc/app/card/card-disabled.vue
  • examples/sites/demos/pc/app/card/basic-usage.vue
  • examples/sites/demos/pc/app/card/operate-bar.vue
  • examples/sites/demos/pc/app/card/card-group.vue
  • examples/sites/demos/pc/app/card/check-type-radio.vue
  • examples/sites/demos/pc/app/card/check-type-checkbox.vue
  • examples/sites/demos/pc/app/card/operate-bar-composition-api.vue
  • examples/sites/demos/pc/app/card/check-mode-composition-api.vue
  • examples/sites/demos/pc/app/card/card-status-composition-api.vue
  • examples/sites/demos/pc/app/card/basic-usage-composition-api.vue
  • examples/sites/demos/pc/app/card/check-type-radio-composition-api.vue
  • examples/sites/demos/pc/app/card/check-type-checkbox-composition-api.vue
  • packages/vue/src/qr-code/src/pc.vue
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: PR E2E Test (pnpm test:e2e3)
🔇 Additional comments (12)
packages/theme/src/vars.less (1)

71-71: Good addition of QR code theme variables

Adding the QR code variables import is consistent with the project structure and helps support dark theme for the QR code component.

examples/sites/demos/pc/app/card/card-group-composition-api.vue (1)

66-66: Well implemented theme variable

Replacing the hardcoded #f5f5f5 with the CSS variable var(--tv-color-bg-gray-1) enables proper dark theme support for the card component.

examples/sites/demos/pc/app/card/slot.vue (1)

73-73: Good implementation of theme variable

The change from hardcoded background color to var(--tv-color-bg-gray-1) properly supports theme switching, including dark mode.

examples/sites/demos/pc/app/card/card-size.vue (1)

64-64: Appropriate use of theme variable

Converting the hardcoded background color to var(--tv-color-bg-gray-1) ensures consistent theming across different card sizes and supports dark mode properly.

examples/sites/demos/pc/app/card/card-size-composition-api.vue (1)

56-56: Good use of CSS variables for theming

Replacing the hardcoded background color with a CSS variable var(--tv-color-bg-gray-1) is a good approach for supporting dark theme. This change ensures that the component will adapt to different themes by changing variable values in a centralized location.

examples/sites/demos/pc/app/card/check-mode.vue (1)

88-88: Good use of CSS variables for theming

Replacing the hardcoded background color with a CSS variable var(--tv-color-bg-gray-1) enables dark theme support. This is consistent with the approach used in other card components.

examples/sites/demos/pc/app/card/card-status.vue (1)

55-55: Good use of CSS variables for theming

Replacing the hardcoded background color with a CSS variable var(--tv-color-bg-gray-1) properly enables dark theme support. This is a consistent approach across the card component files.

examples/sites/demos/pc/app/card/slot-composition-api.vue (1)

64-64: Good use of CSS variables for theming

Replacing the hardcoded background color with a CSS variable var(--tv-color-bg-gray-1) is the right approach for implementing dark theme support. This change follows the pattern established across all card component files.

examples/sites/demos/pc/app/card/card-type.vue (1)

52-52: Good update for theme support!

Replacing the hardcoded #f5f5f5 background color with the CSS variable var(--tv-color-bg-gray-1) improves theme compatibility, allowing the card component to adapt to both light and dark modes.

packages/theme/src/skeleton-item/vars.less (1)

31-31: Excellent transition to theme variables!

This change properly updates the skeleton gradient from hardcoded colors to theme variables. Using var(--tv-color-bg-hover) and var(--tv-color-border-container) ensures the skeleton animation will look appropriate in both light and dark themes.

packages/theme/src/qr-code/index.less (2)

13-13: Good addition of vars import

Adding the import for vars.less is necessary to access the QR code theme variables.


17-20: Proper theme implementation

The injection of QR code variables and addition of background color using var(--tv-QrCode-container-bg-color) correctly implements theme support for the container.

MomoPoppy
MomoPoppy previously approved these changes Mar 10, 2025
@zzcr zzcr merged commit 08123d6 into opentiny:dev Mar 10, 2025
10 checks passed
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