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

feat(checkbox): [checkbox] Component dark theme adaptation #3007

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

Conversation

Youyou-smiles
Copy link
Collaborator

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

feat(checkbox): [checkbox] Component dark theme adaptation

Summary by CodeRabbit

  • Style
    • Refined the checkbox visuals to enhance its appearance in various states (unchecked, checked, half-selected, and disabled).
    • Introduced new color and border options that offer improved visual consistency and responsiveness.
    • Updated interactive states with refreshed icon displays and hover effects for a more intuitive user experience.

Copy link

coderabbitai bot commented Mar 3, 2025

Walkthrough

The pull request restructures the checkbox component’s styling and rendering behavior. In the theme package, several SVG-related styles were removed, and new, state-specific styles (including hover and disabled states) were added in the LESS file and updated via new CSS variables in the vars file. Additionally, the Vue component’s rendering logic was adjusted to use a different icon class for the unchecked state. No public or exported entities were modified.

Changes

File(s) Change Summary
packages/theme/.../index.less
packages/theme/.../vars.less
Removed legacy SVG styles and related CSS variables; added new state-specific styles and variables to control background and border colors for active, hover, and disabled states.
packages/vue/.../pc.vue Updated the rendering logic for the checkbox component: replaced the icon-check class with icon-not-check for the unchecked state.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant CB as Checkbox Component
    participant SVG as SVG Icon
    participant TS as Theme Styles

    U->>CB: Toggle checkbox state
    alt Checkbox is checked
        CB->>SVG: Render icon with "icon-checked-sur" or "icon-halfselect"
    else Checkbox is unchecked
        CB->>SVG: Render icon with "icon-not-check"
    end
    SVG->>TS: Apply corresponding style variables (border, background)
Loading

Possibly related PRs

  • refactor(checkbox): [checkbox] refactor checkbox x-design theme #2174: The changes in the main PR are related to the modifications of the checkbox component's styling, specifically focusing on SVG elements and their states, which directly connects to the updates in the rendering logic of the checkbox in the retrieved PR that alters the icon class used for the unchecked state.
  • feat: [input] add new vars less #2128: The changes in the main PR, which focus on modifying SVG styles and classes for the checkbox component, are related to the retrieved PR as both involve updates to styling variables and classes used in the checkbox component.
  • feat(checkbox): [checkbox] Adapting to the SMB theme #2130: The changes in the main PR, which involve restructuring SVG styles and introducing new classes for checkbox states, are related to the modifications in the retrieved PR that update the rendering logic of the checkbox component's visual representation, specifically the use of the icon-not-check class for the unchecked state.

Suggested reviewers

  • zzcr

Poem

In a meadow of code where styles sprout anew,
I nibble on changes with a hop and a view.
SVGs fade out as fresh classes come to play,
Borders and backgrounds brighten the day.
With each tick and toggle in harmony so true,
This rabbit cheers, delighted for you!
🐇🌿


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 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 the enhancement New feature or request (功能增强) label Mar 3, 2025
Copy link

Walkthrough

This pull request adapts the checkbox component to support a dark theme. It involves significant changes to the styling of the checkbox, including updates to the LESS files for theme variables and component styles, as well as modifications to the Vue component to reflect these style changes.

Changes

Files Summary
packages/theme/src/checkbox/index.less Updated styles for checkbox component to support dark theme, including new styles for checked, unchecked, and disabled states.
packages/theme/src/checkbox/vars.less Added new theme variables for dark theme support and removed unused variables.
packages/vue/src/checkbox/src/pc.vue Modified Vue component to use updated class names for checkbox icons.

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

🧹 Nitpick comments (1)
packages/theme/src/checkbox/index.less (1)

152-180: Good implementation of SVG styling for different checkbox states.

The addition of specific SVG styling for different checkbox states (checked, half-selected, and unchecked) is well-structured and properly leverages CSS variables for theme customization.

However, there's a potential issue with the unchecked state background:

- fill: rgba(255,255,255,0.02);
+ fill: var(--tv-Checkbox-unchecked-bg-color);

The current semi-transparent white background (rgba(255,255,255,0.02)) may not render correctly in all theme environments. Consider creating a new CSS variable for this purpose in the vars file to ensure consistent behavior across themes.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6cbb529 and 157a5c3.

📒 Files selected for processing (3)
  • packages/theme/src/checkbox/index.less (1 hunks)
  • packages/theme/src/checkbox/vars.less (1 hunks)
  • packages/vue/src/checkbox/src/pc.vue (1 hunks)
🔇 Additional comments (1)
packages/vue/src/checkbox/src/pc.vue (1)

73-73: Updated the unchecked state styling with an appropriate class name.

This change modifies the class name for the unchecked checkbox icon from icon-check to icon-not-check, which better aligns with its purpose in the UI and allows for more specific styling in the dark theme adaptation.

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

♻️ Duplicate comments (1)
packages/theme/src/checkbox/index.less (1)

181-200: 🛠️ Refactor suggestion

Replace Hardcoded Color in Disabled State Icons

Within the disabled state for the checkbox input, the path:last-child of the .icon-checked-sur, .icon-halfselect block (line 187) is still using a hardcoded color (#FFFFFF). This duplicates an earlier review comment recommending the use of a CSS variable to ensure consistent theming. Consider replacing the hardcoded value with the appropriate CSS variable (for example, var(--tv-Checkbox-border-color-inverse)) to maintain theme consistency.

Proposed diff:

-          fill: #FFFFFF;
+          fill: var(--tv-Checkbox-border-color-inverse);
🧹 Nitpick comments (1)
packages/theme/src/checkbox/index.less (1)

151-180: Dark Theme Input Styling – Updated SVG and Icon States

The new styles under &__input effectively set the SVG dimensions and update the icon fill properties for various states. The use of CSS variables (e.g., var(--tv-Checkbox-svg-width), var(--tv-Checkbox-bg-active-color), and var(--tv-Checkbox-border-color-inverse)) helps ensure consistency with the dark theme adaptation. Please double-check that the values for the subtle fill (rgba(255,255,255,0.02)) and hover state (var(--tv-Checkbox-unchecked-border-hover-color)) match the design specifications across all states.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 157a5c3 and b8341b4.

📒 Files selected for processing (2)
  • packages/theme/src/checkbox/index.less (1 hunks)
  • packages/theme/src/checkbox/vars.less (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/theme/src/checkbox/vars.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
enhancement New feature or request (功能增强)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant