Skip to content

fix(grid): [grid] update dark theme #3123

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
Mar 16, 2025

Conversation

wuyiping0628
Copy link
Collaborator

@wuyiping0628 wuyiping0628 commented Mar 13, 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 appearance across grid components with updated background and color styling.
    • Adopted a dynamic theming approach for elements such as grids, filters, loading screens, and interactive states.
    • Refined hover, focus, and active styles for inputs and buttons, ensuring a more cohesive and modern user experience.
    • Introduced new CSS variables for improved customization of button, input, and select dropdown styles.

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

coderabbitai bot commented Mar 13, 2025

Walkthrough

The pull request updates the CSS styling for several grid components. Hardcoded background colors in Vue component files and LESS theme files have been replaced with CSS variables, resulting in more dynamic theming. Additionally, tests have been updated to reflect the new color values. No changes were made to any exported or public entities.

Changes

File(s) Change Summary
examples/sites/demos/pc/app/grid/custom-style/class-name.vue,
class-name-composition-api.vue,
class-name.spec.js
Updated .gridClassName styles: replaced background with background-color and changed color from #e6f7ff to #2db7f5; test expectations updated accordingly.
examples/sites/demos/pc/app/grid/editor/active-strictly*.vue,
editor-bg*.vue
Changed .disable-cell-edit background from a fixed #e8ebef to the CSS variable var(--tv-color-bg-disabled) for dynamic theming.
examples/sites/demos/pc/app/grid/loading/grid-custom-loading*.vue Modified .custom-loading background styling from rgba(0, 0, 0, 0.3) to var(--tv-color-bg-mask) to enable variable-based styling.
packages/theme/src/grid/filter.less,
loading.less,
menu.less,
table.less,
toolbar.less,
vars.less
Updated grid theming: replaced hardcoded colors with CSS variables, refined hover effects, and introduced new custom properties for inputs, buttons, select options, and loading masks.

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • zzcr

Poem

I'm a rabbit, hopping through the code,
Discovering styles in every node.
Fixed hues turned to variables so bright,
Lighting up grids with a dynamic light.
With a skip and a nibble, I cheer with delight,
For fresh, themed colors that just feel 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.

 ERR_PNPM_OPTIONAL_DEPS_REQUIRE_PROD_DEPS  Optional dependencies cannot be installed without production dependencies

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.

📜 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 bcac46c and 283c1c3.

📒 Files selected for processing (4)
  • examples/sites/demos/pc/app/grid/loading/grid-custom-loading-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/grid/loading/grid-custom-loading.vue (1 hunks)
  • packages/theme/src/grid/vars.less (2 hunks)
  • packages/theme/src/loading/vars.less (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/theme/src/loading/vars.less
🚧 Files skipped from review as they are similar to previous changes (3)
  • examples/sites/demos/pc/app/grid/loading/grid-custom-loading-composition-api.vue
  • examples/sites/demos/pc/app/grid/loading/grid-custom-loading.vue
  • packages/theme/src/grid/vars.less
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: PR E2E Test (pnpm test:e2e3)

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

Walkthrough

This pull request updates the dark theme for the grid component in the opentiny/tiny-vue repository. The changes involve updating CSS styles to use CSS variables for background colors and other style properties, enhancing the theme's consistency and customization capabilities.

Changes

Files Summary
class-name-composition-api.vue, class-name.vue Updated .gridClassName background color to #2db7f5.
active-strictly-composition-api.vue, active-strictly.vue, editor-bg-composition-api.vue, editor-bg.vue Changed .disable-cell-edit background color to var(--tv-color-bg-disabled).
grid-custom-loading-composition-api.vue, grid-custom-loading.vue Updated background to var(--tv-color-bg-active-dark).
filter.less Modified padding and background color of .@{grid-prefix-cls}__filter-body, added styles for input and button elements, and adjusted filter option styles.
loading.less, toolbar.less Changed background color to var(--tv-Grid-loading-mask-bg-color).
menu.less Updated background color to var(--tv-Grid-bg-color).
table.less Modified hover and input background colors, added styles for select options.
vars.less Added and updated CSS variables for input and button styles.

Copy link

Walkthrough

This pull request updates the dark theme for the grid component in the opentiny/tiny-vue repository. The changes involve updating CSS styles to use CSS variables for background colors and other style properties, enhancing the theme's consistency and customization capabilities.

Changes

Files Summary
class-name-composition-api.vue, class-name.vue Updated .gridClassName background color to #2db7f5.
active-strictly-composition-api.vue, active-strictly.vue, editor-bg-composition-api.vue, editor-bg.vue Changed .disable-cell-edit background color to var(--tv-color-bg-disabled).
grid-custom-loading-composition-api.vue, grid-custom-loading.vue Updated background to var(--tv-color-bg-active-dark).
filter.less Modified padding and background color of .@{grid-prefix-cls}__filter-body, added styles for input and button elements, and adjusted filter option styles.
loading.less, toolbar.less Changed background-color to var(--tv-Grid-loading-mask-bg-color).
menu.less Changed background-color to var(--tv-Grid-bg-color).
table.less Updated hover and input background colors, added styles for select options.

Copy link

Walkthrough:

This PR updates the dark theme for the grid component by replacing hardcoded background colors with CSS variables for better theme management and consistency. It also updates the corresponding test cases to reflect these changes.

Changes

Files Summary
class-name-composition-api.vue, class-name.vue Updated .gridClassName background color to #2db7f5.
active-strictly-composition-api.vue, active-strictly.vue, editor-bg-composition-api.vue, editor-bg.vue Changed .disable-cell-edit background color to var(--tv-color-bg-disabled).
grid-custom-loading-composition-api.vue, grid-custom-loading.vue Updated background to var(--tv-color-bg-active-dark).
filter.less Modified padding and background color of .@{grid-prefix-cls}__filter-body, added styles for input and button elements, and adjusted filter option styles.
loading.less, toolbar.less Changed background-color to var(--tv-Grid-loading-mask-bg-color).
menu.less Changed background-color to var(--tv-Grid-bg-color).
table.less Updated hover styles for .row__highlight &-body__row:not(.row__selected), and background color for var(--tv-Grid-input-bg-color).
class-name.spec.js Updated test to check for new background color value rgb(45, 183, 245).

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

142-143: Dark Theme Filter Input Background Variable Added
The new CSS variable --tv-Grid-filter-input-bg-color is introduced to define the filter input’s background. Please verify that using var(--tv-color-bg-secondary) aligns with your dark theme design for the grid filters.


183-186: Review Input Padding Variable Comments
There appears to be a mismatch between the comments and the variable names for input padding. The comment on line 183 indicates a vertical padding dimension while the variable --tv-Grid-input-padding-x (typically representing horizontal padding) is used. Likewise, the comment on line 185 indicating horizontal padding precedes the use of --tv-Grid-input-padding-y (typically vertical). Please confirm the intended semantics and update either the comments or the variable names accordingly for clarity.


191-192: Typo in Input Font Size Comment
The comment on line 191 reads “内置输入框框字体大小” which seems to include an extra “框”. For clarity and consistency, consider revising it to “内置输入框字体大小”.


207-210: Mismatch in Button Property Comment
The comment on line 209 incorrectly refers to button text color, while the declared variable --tv-Grid-button-border-radius actually sets the button's border radius. Please update the comment to accurately reflect that this variable controls the button’s border radius.


215-220: Dark Theme Variables for Select and Loading Mask
The updated variables for the select dropdown (--tv-Grid-select-option-bg-color and --tv-Grid-select-option-bg-color-hover) as well as the loading mask (--tv-Grid-loading-mask-bg-color) correctly incorporate dark theme values. Ensure that these values consistently align with your overall dark theme palette for the grid components.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9e381e3 and bcac46c.

📒 Files selected for processing (15)
  • examples/sites/demos/pc/app/grid/custom-style/class-name-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/grid/custom-style/class-name.spec.js (1 hunks)
  • examples/sites/demos/pc/app/grid/custom-style/class-name.vue (1 hunks)
  • examples/sites/demos/pc/app/grid/editor/active-strictly-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/grid/editor/active-strictly.vue (1 hunks)
  • examples/sites/demos/pc/app/grid/editor/editor-bg-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/grid/editor/editor-bg.vue (1 hunks)
  • examples/sites/demos/pc/app/grid/loading/grid-custom-loading-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/grid/loading/grid-custom-loading.vue (1 hunks)
  • packages/theme/src/grid/filter.less (8 hunks)
  • packages/theme/src/grid/loading.less (1 hunks)
  • packages/theme/src/grid/menu.less (1 hunks)
  • packages/theme/src/grid/table.less (2 hunks)
  • packages/theme/src/grid/toolbar.less (1 hunks)
  • packages/theme/src/grid/vars.less (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: PR E2E Test (pnpm test:e2e3)
🔇 Additional comments (20)
examples/sites/demos/pc/app/grid/custom-style/class-name.vue (1)

87-87: Updated background styling for better dark theme compatibility

The change from using background to background-color with a more saturated blue color (#2db7f5) improves visibility in dark theme. This is in line with the PR's objective of updating the grid's dark theme.

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

78-78: Consistent styling update across API variants

The same background color update applied to the Options API version has been correctly applied here to the Composition API version, ensuring visual consistency across implementation styles.

examples/sites/demos/pc/app/grid/custom-style/class-name.spec.js (1)

6-6: Test updated to match new styling values

The test expectation has been properly updated to check for the new background color value (rgb(45, 183, 245)), which is the RGB equivalent of the #2db7f5 hex color used in the components.

examples/sites/demos/pc/app/grid/loading/grid-custom-loading-composition-api.vue (1)

73-73: Improved theming with CSS variables

Replacing the hardcoded background color with a CSS variable (--tv-color-bg-active-dark) enhances theme customization capabilities, particularly for dark themes. This change is aligned with modern CSS practices and supports the PR's goal of updating the dark theme.

examples/sites/demos/pc/app/grid/editor/active-strictly.vue (1)

88-92: Replace Hardcoded Color with CSS Variable in Disabled Cell Styling
Changing the background color in the .disable-cell-edit class from a fixed value to var(--tv-color-bg-disabled) ensures that the component now inherits the dynamic theming provided by the dark theme update. This enhances customization and consistency across the grid components.

packages/theme/src/grid/loading.less (1)

27-27: Utilize CSS Variable for Loading Mask Background
The update from a hardcoded RGBA color to var(--tv-Grid-loading-mask-bg-color) in the loading mask styling improves the flexibility and maintainability of the theme. Please verify that this CSS variable is defined appropriately in the project's global theme settings.

examples/sites/demos/pc/app/grid/editor/active-strictly-composition-api.vue (1)

80-83: Adopt CSS Variable for Disabled Cell Background
Updating the .disable-cell-edit class with the CSS variable var(--tv-color-bg-disabled) aligns this component with the new dark theme standards and ensures a unified styling approach across grid editors.

examples/sites/demos/pc/app/grid/editor/editor-bg.vue (1)

84-87: Standardize Disabled Cell Styling Using CSS Variable
Changing the background color of the .disable-cell-edit class to var(--tv-color-bg-disabled) promotes consistency within the grid’s theming. This refactor supports centralized control over theme colors, making future adjustments easier.

examples/sites/demos/pc/app/grid/editor/editor-bg-composition-api.vue (1)

75-78: Enhance Theming Flexibility with CSS Variable
Switching the background color property in the .disable-cell-edit style to use var(--tv-color-bg-disabled) meets the dark theme update objective. This change contributes to a more dynamic, customizable interface for grid components.

examples/sites/demos/pc/app/grid/loading/grid-custom-loading.vue (1)

86-86: Updated Loading Background Styling
The direct RGBA color has been replaced with the CSS variable var(--tv-color-bg-active-dark), which supports dynamic theming for the dark grid mode. Please verify that this variable is properly defined in the theme’s LESS files.

packages/theme/src/grid/menu.less (1)

28-28: Applied CSS Variable for Grid Menu Background
The hardcoded background color is now replaced with var(--tv-Grid-bg-color), enhancing theme flexibility across the grid menu component. Please ensure that this variable’s value is set appropriately in the theme variables file.

packages/theme/src/grid/toolbar.less (1)

60-60: Updated Loading Mask Background
The background color for the loading mask is now defined via the CSS variable var(--tv-Grid-loading-mask-bg-color), aligning it with the dynamic theming approach. Confirm that the variable is updated to match the dark theme requirements.

packages/theme/src/grid/table.less (1)

433-439: Refined Row Hover Highlight Behavior
The selector has been updated to use .row__highlight &-body__row:not(.row__selected):hover, which prevents the hover effect from overriding the styling of selected rows. This enhances clarity and user experience.

packages/theme/src/grid/filter.less (7)

65-69: Enhanced Filter Body Styling
The filter body now uses a fixed 10px padding and the background color is set via var(--tv-Grid-bg-color), ensuring consistency with the overall dark theme.


71-93: Improved Filter Input Styles
All inputs (excluding radio types) within the filter panel now leverage CSS variables for properties such as border, border-radius, color, background color, and padding. The hover, focus, and active states are also explicitly defined, contributing to a consistent and refined theme.


95-112: Standardized Filter Button Styling
The button styles are now standardized using theme-specific variables for font weight, border, background, and padding. This update guarantees a uniform appearance across the grid’s filter component.


159-163: Consistent Empty State Text Color
The text color for the filter empty state is updated to use var(--tv-Grid-text-color), ensuring that the styling remains consistent with the dark theme design.


277-286: Updated Filter Input Field Background
The filter option input field now sets its background using var(--tv-Grid-filter-input-bg-color), along with standardized border, padding, and height. This change helps integrate the component seamlessly with the dark theme.


187-203: Refined Checkbox Icon Styling in Filter Options
Within the filter options, the checkbox icons have been improved: the first path is set to transparent by default, and when checked (&.is-checked), the first path fills with var(--tv-Grid-checkbox-icon-color-selected) while the last path becomes white. Additionally, the hover state is updated using var(--tv-Grid-checkbox-icon-color-hover). These changes ensure interactive feedback aligns with the overall theming.


312-318: Consistent Filter Date Item Styling
The filter date items now employ flex properties for alignment and use the theme’s text color (via var(--tv-Grid-text-color)). This minor adjustment enhances readability and ensures consistency with the dark theme.

@zzcr zzcr merged commit b107f58 into opentiny:dev Mar 16, 2025
10 checks passed
# 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.

3 participants