Skip to content
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

fix(grid): [grid] add dark theme #3040

Open
wants to merge 7 commits into
base: dev
Choose a base branch
from

Conversation

wuyiping0628
Copy link
Collaborator

@wuyiping0628 wuyiping0628 commented Mar 4, 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
    • Updated the disabled drag row styling to utilize theme-based CSS variables.
    • Enhanced the grid's visual design by applying theme variables to input fields, icons, and text for a more consistent look.
    • Introduced new custom properties that offer flexible theming options for grid components.
    • Improved checkbox and radio button visual feedback by modifying SVG icon appearances based on their checked states.
    • Updated border colors in various components to ensure consistency across the grid styling.

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

coderabbitai bot commented Mar 4, 2025

Walkthrough

This pull request updates the styling of grid and Vue components by replacing hardcoded color values with CSS variables. In two Vue component files, the background color for the .row__drag-disable class is changed from #f1f1f1 to var(--tv-color-bg-disabled). Additionally, enhancements have been made in the grid’s LESS files to utilize CSS variables for SVG fill colors, input backgrounds, and column anchor text colors, and new CSS custom properties have been introduced for further theming options. No changes were made to the exported or public entities.

Changes

File(s) Change Summary
examples/.../row-drag-ctrl.vue and examples/.../row-drag-ctrl-composition-api.vue Updated the scoped CSS for .row__drag-disable to use var(--tv-color-bg-disabled) instead of #f1f1f1.
packages/.../table.less Updated various CSS properties to use var(--tv-Grid-border-color-divider) for borders and introduced new properties for input backgrounds and text colors.
packages/.../vars.less Renamed --tv-Grid-divider-color to --tv-Grid-border-color-divider and added new properties: --tv-Grid-column-anchor-text-color and --tv-Grid-Input-bg-color.
packages/.../checkbox.less Added styling rules for checkbox icons based on checked state, adjusting SVG fill for checked and unchecked states.
packages/.../radio.less Modified radio button icon styling, changing background color to transparent and adjusting SVG fill for checked and unchecked states.
packages/.../filter.less Updated border properties in .filter-panel and .filter-option__btns to use var(--tv-Grid-border-color-divider).
packages/.../input.less Updated input elements to use var(--tv-Grid-border-color-divider) for border color.
packages/.../menu.less Modified border-bottom property of .grid-menu__clild-wrapper to use var(--tv-Grid-border-color-divider).

Possibly related PRs

Suggested reviewers

  • zzcr

Poem

I'm a bunny on the code trail,
Hopping with styles that never fail.
Colors shifted to variables so neat,
Making grids and rows a visual treat.
With every hop, I celebrate this sweet feat! 🐰


🪧 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 4, 2025
Copy link

Walkthrough

This PR introduces a dark theme to the grid component by updating the CSS variables to use theme-based colors. It replaces hardcoded color values with CSS variables to ensure consistency and easy theme management.

Changes

Files Summary
examples/sites/demos/pc/app/grid/drag/row-drag-ctrl-composition-api.vue, examples/sites/demos/pc/app/grid/drag/row-drag-ctrl.vue Updated background color for .row__drag-disable to use a CSS variable for theme consistency.
packages/theme/src/grid/table.less Added CSS variables for SVG fill and input background color to support dark theme.
packages/theme/src/grid/vars.less Introduced new CSS variables for text color and input background color to facilitate dark theme integration.

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 (1)
packages/theme/src/grid/checkbox.less (1)

95-97: Clarify Indeterminate State Styling
In the indeterminate state, the first SVG path’s fill is explicitly set to use var(--tv-Grid-checkbox-icon-color-selected). Verify that using the same “selected” color for both checked and indeterminate states is intentional from a design perspective. If a distinct visual representation is needed for indeterminate checkboxes, consider introducing a separate variable.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 023744c and 19fa079.

📒 Files selected for processing (2)
  • packages/theme/src/grid/checkbox.less (2 hunks)
  • packages/theme/src/grid/radio.less (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: PR E2E Test (pnpm test:e2e3)
🔇 Additional comments (5)
packages/theme/src/grid/checkbox.less (1)

76-83: Consistent Unchecked State Styling
The new block for unchecked checkboxes correctly ensures that the first child of the SVG path is set to transparent. This aligns with the dark theme’s visual requirements and prevents unwanted icon fill. Please confirm that this behavior is desired across all themes.

packages/theme/src/grid/radio.less (4)

15-15: Verify Radio Prefix Interpolation
The use of the tilde operator for @grid-radio-prefix-cls (i.e. ~'@{css-prefix}grid-radio') is consistent with techniques seen elsewhere in the codebase. Please double-check that the resulting string correctly resolves in all theme contexts.


56-57: Ensure Transparent Background for Checked State
The addition of background: transparent; in the checked state of the radio icon is appropriate to prevent background conflicts with the dark theme. Ensure this style does not unintentionally override other intended background properties.


78-82: Set Transparent Fill for SVG in Checked State
The newly added rule to set fill: transparent; for the last child path within the SVG ensures that unwanted icon parts do not display in the checked state. This change supports the dark theme’s aesthetics.


88-95: Consistent Styling for Unchecked State
The added block for the unchecked radio state ensures that the last SVG path has a transparent fill. This creates consistency with the checked state styling and likely helps maintain visual uniformity across themes.

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 (1)
packages/theme/src/grid/menu.less (1)

43-43: Update Variable Reference for Border Style

The updated variable from the old "divider" to "border-color-divider" is consistent with similar changes across related files. Please verify that the custom property --tv-Grid-border-color-divider is correctly defined within the dark theme settings so that it reflects the intended appearance.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 19fa079 and 991e2e5.

📒 Files selected for processing (5)
  • packages/theme/src/grid/filter.less (2 hunks)
  • packages/theme/src/grid/input.less (1 hunks)
  • packages/theme/src/grid/menu.less (1 hunks)
  • packages/theme/src/grid/table.less (10 hunks)
  • packages/theme/src/grid/vars.less (3 hunks)
✅ Files skipped from review due to trivial changes (2)
  • packages/theme/src/grid/input.less
  • packages/theme/src/grid/filter.less
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/theme/src/grid/vars.less
  • packages/theme/src/grid/table.less
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: PR E2E Test (pnpm test:e2e3)

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.

2 participants