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(theme): fix error css vars #2338

Merged
merged 1 commit into from
Oct 21, 2024
Merged

fix(theme): fix error css vars #2338

merged 1 commit into from
Oct 21, 2024

Conversation

gimmyhehe
Copy link
Member

@gimmyhehe gimmyhehe commented Oct 21, 2024

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

Release Notes

  • New Features

    • Introduced loading animations for various components, enhancing visual feedback during loading states.
  • Bug Fixes

    • Corrected variable references across multiple stylesheets to ensure proper styling, including text colors and padding properties.
    • Enhanced validation error styles for table components to ensure accurate rendering of success indicators.
  • Improvements

    • Refined styles for table components, including size adjustments and new styles for loading, empty, and expanded row states.
    • Updated color schemes and hover effects for the search component to improve user interaction.

@gimmyhehe gimmyhehe added the bug Something isn't working label Oct 21, 2024
Copy link

coderabbitai bot commented Oct 21, 2024

Walkthrough

The pull request includes modifications to several LESS stylesheets, primarily focusing on correcting variable references and enhancing the styling of various components. Key changes involve fixing syntax errors in variable declarations, refining table component styles for different sizes and states, and updating color properties in the search and select dropdown components. The adjustments ensure proper rendering and consistent styling across the application, without introducing significant changes to the overall structure or logic.

Changes

File Path Change Summary
packages/theme/src/base/reset.less Corrected variable reference from var(----tv-color-text-active) to var(--tv-color-text-active). Added loading animation for .@{css-prefix-iconfont}-loading.
packages/theme/src/cascader-panel/vars.less Updated padding variables by correcting ----tv-space-xl to --tv-space-xl for node labels.
packages/theme/src/grid/table.less Adjusted styles for table sizes, enhanced validation styles, added loading and empty state styles, and modified expanded row styles. Corrected border color from ---tv-Grid-success-border-color to --tv-Grid-success-border-color.
packages/theme/src/search/index.less Updated color for & &__selector, maintained hover states, and preserved layout properties.
packages/theme/src/select-dropdown/vars.less Corrected variable reference for dropdown's tip text color from var(---tv-color-text-secondary) to var(--tv-color-text-secondary).

Possibly related PRs

Suggested reviewers

  • zzcr

Poem

🐰 In the meadow of code, where styles bloom bright,
Variables dance, correcting their plight.
From loading to tables, each change is a cheer,
A rabbit hops forth, with joy we hold dear!
With colors and padding, our styles take flight,
Hooray for the changes, let’s code through the night! 🌙


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 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

[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

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

🧹 Outside diff range and nitpick comments (4)
packages/theme/src/cascader-panel/vars.less (1)

29-29: Correct CSS variable reference and consider refactoring

The fix properly references the --tv-space-xl variable, which is correct and consistent with the previous change.

Consider refactoring to avoid repetition:

--tv-CascaderPanel-node-label-padding: var(--tv-space-xl, 16px);
--tv-CascaderPanel-node-label-padding-right: var(--tv-CascaderPanel-node-label-padding);
--tv-CascaderPanel-node-label-padding-left: var(--tv-CascaderPanel-node-label-padding);

This approach would centralize the padding value and make future updates easier.

packages/theme/src/base/reset.less (1)

34-34: Approved: CSS variable syntax corrected.

The change from ----tv-color-text-active to --tv-color-text-active fixes the CSS variable syntax, which is correct and consistent with other files in this PR.

Consider adding a comment explaining why !important is necessary here, as it's generally best to avoid using it unless absolutely required:

.tiny-hl-query-node {
  // Use !important to ensure consistent highlighting across all contexts
  color: var(--tv-color-text-active) !important;
}
packages/theme/src/grid/table.less (2)

927-929: Good catch: Fixed CSS variable syntax

This change corrects the syntax for the CSS variable --tv-Grid-success-border-color. Using two dashes instead of three ensures that the variable will be properly recognized and applied.

Consider adding a comment explaining the significance of this color, e.g., "// Indicates a successfully validated dirty cell".


Line range hint 1-1284: Overall: Well-structured and comprehensive grid styles

This LESS file provides a robust set of styles for a complex grid/table component. The minor fix to the CSS variable syntax improves the code quality. The file demonstrates good organization, covers various scenarios and states, and should provide a solid foundation for the grid component's appearance and behavior.

Consider adding more comments throughout the file to explain the purpose of different sections and complex selectors. This would improve maintainability for future developers working on this stylesheet.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 9397afb and c78ae17.

📒 Files selected for processing (5)
  • packages/theme/src/base/reset.less (1 hunks)
  • packages/theme/src/cascader-panel/vars.less (1 hunks)
  • packages/theme/src/grid/table.less (1 hunks)
  • packages/theme/src/search/index.less (1 hunks)
  • packages/theme/src/select-dropdown/vars.less (1 hunks)
🧰 Additional context used
🔇 Additional comments (8)
packages/theme/src/cascader-panel/vars.less (2)

27-27: Correct CSS variable reference

The fix properly references the --tv-space-xl variable. This correction is crucial for ensuring the correct padding is applied to the CascaderPanel node labels.


27-29: Summary of changes and their impact

These corrections to the CSS variable references are crucial for the proper styling of the CascaderPanel component. They align with similar fixes across other files mentioned in the PR summary, indicating a systematic resolution of incorrect variable references.

To ensure the effectiveness of these changes:

Run the following script to check for any remaining incorrect CSS variable references in the theme directory:

This will help verify that all similar issues have been addressed across the theme files.

packages/theme/src/select-dropdown/vars.less (1)

21-21: Correct CSS variable reference

The change from var(---tv-color-text-secondary, #595959) to var(--tv-color-text-secondary, #595959) is correct. This fixes the CSS custom property reference, ensuring the proper variable is used for the select dropdown tip text color.

To ensure consistency across the codebase, let's verify if there are any remaining instances of incorrectly formatted CSS variable references:

If this script returns any results, those instances should also be corrected.

✅ Verification successful

All CSS variable references correctly formatted

No instances of incorrectly formatted CSS variable references found beyond the reviewed change.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for CSS variables with more than two leading dashes

# Test: Search for CSS var() calls with more than two leading dashes
rg -g '*.{css,less,scss,vue}' 'var\(-{3,}[a-zA-Z0-9-]+\)'

Length of output: 59


Script:

#!/bin/bash
# Description: Check for CSS var() calls with more than two leading dashes

# Test: Search for var() with three or more dashes in CSS, LESS, SCSS, and Vue files
rg -g '*.{css,less,scss,vue}' 'var\(-{3,}[a-zA-Z0-9-]+\)'

Length of output: 59

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

195-195: Approved: Corrected CSS variable for selector text color

This change improves the clarity and correctness of the styling for the search selector text color. The previous value appeared to be an erroneous concatenation of two different CSS variables, which could have led to unexpected styling behavior. The new value var(--tv-Search-selector-text) is a properly named, single CSS variable that accurately represents the intended styling property.

This modification enhances code readability and maintains consistency in the theme's variable naming convention.

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

Line range hint 1-926: LGTM: Well-structured and comprehensive styles

The first part of this LESS file demonstrates a well-organized approach to styling a complex grid/table component. It covers various scenarios, states, and responsive designs, which is commendable.


Line range hint 930-1135: LGTM: Comprehensive styling for form elements and grid components

This section provides detailed styling for various form inputs, filters, and grid components. The code is well-organized and covers different states and interactions.


Line range hint 1136-1270: LGTM: Well-defined styles for interactive elements

This section provides comprehensive styling for column anchors, operation columns, and row validation. The code is well-organized and covers various interactive states, enhancing the user experience.


Line range hint 1271-1284: LGTM: Clear and concise fullscreen styles

The fullscreen styles are well-defined and should provide a good user experience when the table is displayed in fullscreen mode.

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