Skip to content

fix:[steps,date-picker,tabs,search]Dark Theme Adaptation #3231

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 1 commit into from
Apr 2, 2025

Conversation

discreted66
Copy link
Collaborator

@discreted66 discreted66 commented Apr 2, 2025

PR

fix:暗色主题适配

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 date picker background for a refreshed look.
    • Enhanced the date range confirmation button styling.
    • Refined the search input button with improved background and opacity for dynamic theming.
    • Improved the steps component appearance with adjusted spacing, padding, and error highlighting.
    • Adjusted the tabs layout with revised spacing and larger "more" icons.
    • Replaced the previous failure icon in the upload list with a clearer error indicator.
    • Updated the dropdown item count in the tabs component tests for accuracy.

Copy link

coderabbitai bot commented Apr 2, 2025

Walkthrough

This pull request applies multiple UI and styling updates across several components. The changes update background colors for the date picker, adjust button styling in the date range component, and refine styling for search inputs, steps, and tabs by introducing new CSS variables and modifying layout properties. Additionally, minor logic adjustments are made in the tab navigation component for padding determination and in the upload list component for consistent error icon usage.

Changes

File(s) Change Summary
examples/.../date-picker/custom-suffix-icon[-composition-api].vue Updated the .my-date-picker background property from var(--tv-color-bg-active-emphasize) to var(--tv-color-bg-2).
packages/renderless/.../date-range/vue.ts Changed the plain property of confirmButtonProps from true to false for styled appearance.
packages/theme/src/search/(index, vars).less In index.less: Updated &__input-btn background-color from #000000 to var(--tv-Search-border-short-color) and opacity from 8% to 1; In vars.less: Added a new variable --tv-Search-border-short-color.
packages/theme/src/steps/(index, vars).less In index.less: Removed .right-line, added padding-top: 2px to .title, updated .fault colors to use CSS variables, and added a new .disabled state with adjusted styles; In vars.less: Updated and added CSS properties for vertical dot active and undo states.
packages/theme/src/tabs/(index, vars).less In index.less: Removed &__nav-scroll and modified spacing in header, new-tab, and more container classes; In vars.less: Updated --tv-Tabs-more-icon-size from a small to a larger font size.
packages/vue/src/(tabs/src/tab-nav/pc.vue, upload-list/src/pc.vue) In tab-nav/pc.vue: Changed the default right padding from '46px' to '0' when no more element is present; In upload-list/src/pc.vue: Replaced the import and usage of iconOperationfaild with IconError.

Sequence Diagram(s)

sequenceDiagram
    participant TabNav as TabNav Component
    participant MoreEl as More Element ($refs.more)
    
    TabNav->>MoreEl: Check if more element exists
    alt When more element exists
        MoreEl-->>TabNav: Return width value
        TabNav->>TabNav: Set paddingRight based on width
    else When more element does not exist
        TabNav->>TabNav: Set paddingRight to '0'
    end
Loading

Possibly related PRs

Poem

I'm a curious rabbit, hopping around in code,
With CSS tweaks that lighten every node.
My date picker glows with a brand new hue,
And the tabs and steps dance fresh and true.
In a world of styles, I skip with delight—
CodeRabbit Inc. makes everything bright!
🐰✨

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.

examples/sites/demos/pc/app/date-picker/custom-suffix-icon-composition-api.vue

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-vue".

(The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-vue@latest --save-dev

The plugin "eslint-plugin-vue" was referenced from the config file in ".eslintrc.js » @antfu/eslint-config » @antfu/eslint-config-vue".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

examples/sites/demos/pc/app/date-picker/custom-suffix-icon.vue

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-vue".

(The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-vue@latest --save-dev

The plugin "eslint-plugin-vue" was referenced from the config file in ".eslintrc.js » @antfu/eslint-config » @antfu/eslint-config-vue".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

examples/sites/demos/pc/app/tabs/custom-more-icon.spec.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-vue".

(The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-vue@latest --save-dev

The plugin "eslint-plugin-vue" was referenced from the config file in ".eslintrc.js » @antfu/eslint-config » @antfu/eslint-config-vue".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

  • 3 others

📜 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 d0a39ef and 99aba33.

📒 Files selected for processing (12)
  • examples/sites/demos/pc/app/date-picker/custom-suffix-icon-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/date-picker/custom-suffix-icon.vue (1 hunks)
  • examples/sites/demos/pc/app/tabs/custom-more-icon.spec.ts (1 hunks)
  • packages/renderless/src/date-range/vue.ts (1 hunks)
  • packages/theme/src/search/index.less (1 hunks)
  • packages/theme/src/search/vars.less (1 hunks)
  • packages/theme/src/steps/index.less (5 hunks)
  • packages/theme/src/steps/vars.less (1 hunks)
  • packages/theme/src/tabs/index.less (4 hunks)
  • packages/theme/src/tabs/vars.less (1 hunks)
  • packages/vue/src/tabs/src/tab-nav/pc.vue (1 hunks)
  • packages/vue/src/upload-list/src/pc.vue (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (11)
  • examples/sites/demos/pc/app/date-picker/custom-suffix-icon.vue
  • packages/vue/src/tabs/src/tab-nav/pc.vue
  • examples/sites/demos/pc/app/date-picker/custom-suffix-icon-composition-api.vue
  • packages/theme/src/search/vars.less
  • packages/renderless/src/date-range/vue.ts
  • packages/theme/src/tabs/vars.less
  • packages/theme/src/search/index.less
  • packages/vue/src/upload-list/src/pc.vue
  • packages/theme/src/tabs/index.less
  • packages/theme/src/steps/vars.less
  • packages/theme/src/steps/index.less
🔇 Additional comments (1)
examples/sites/demos/pc/app/tabs/custom-more-icon.spec.ts (1)

21-21:

❓ Verification inconclusive

Verify this expectation change is intentional.

The test now expects 2 dropdown items instead of the previous 3. This change suggests that with the dark theme styling adjustments, fewer tabs are being moved to the overflow dropdown. Please confirm this is an expected side effect of the styling changes and not an unintended regression.


🏁 Script executed:

#!/bin/bash
# Check related tab component styling changes that might affect overflow behavior

echo "Checking tab styling changes that might affect overflow calculations:"
rg -A 3 -B 3 "tabs" --type=less

Length of output: 87651


Confirm Intentional Overflow Behavior Change

The test in examples/sites/demos/pc/app/tabs/custom-more-icon.spec.ts (line 21) has been updated to expect 2 dropdown items instead of the previous 3. This appears linked to the dark theme styling adjustments shown in the theme’s LESS files, which may now be causing fewer tabs to move to the overflow dropdown.

  • Please verify that this reduced count is an intentional design decision.
  • If the behavior is expected under the dark theme, confirm the change and update related documentation/tests as needed.
  • Otherwise, double-check that no regression has been introduced in the tab overflow behavior.
✨ 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 plan to trigger planning for file edits and PR creation.
  • @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 bug Something isn't working label Apr 2, 2025
Copy link

Walkthrough

This pull request focuses on adapting various components such as steps, date-picker, tabs, and search for a dark theme. The changes involve updating background colors, border colors, and other style properties to ensure compatibility with the dark theme.

Changes

Files Summary
examples/sites/demos/pc/app/date-picker/custom-suffix-icon-composition-api.vue, examples/sites/demos/pc/app/date-picker/custom-suffix-icon.vue Updated background color for .my-date-picker class to adapt to dark theme.
packages/renderless/src/date-range/vue.ts Changed confirmButtonProps to set plain to false.
packages/theme/src/search/index.less, packages/theme/src/search/vars.less Updated search border color and opacity for dark theme adaptation.
packages/theme/src/steps/index.less, packages/theme/src/steps/vars.less Modified steps component styles including border and text colors for dark theme.
packages/theme/src/tabs/index.less, packages/theme/src/tabs/vars.less Adjusted tabs component styles such as icon sizes and padding for dark theme.
packages/vue/src/date-range/src/mobile-first.vue Added an unintended number 222 in the template.
packages/vue/src/tabs/src/tab-nav/pc.vue Changed default padding-right for tabs list box.
packages/vue/src/upload-list/src/pc.vue Renamed iconOperationfaild to IconError.

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 (10)
packages/theme/src/tabs/index.less (4)

61-70: New Tab Button Spacing Adjustment
The .@{tabs-prefix-cls}__new-tab block now sets a left padding of 12px (line 64), which appears to reduce the gap compared to previous styling. Please verify that this new spacing aligns with the dark theme design guidelines and does not lead to cramped content.


74-78: Icon Size and Padding Update in New Tab
Within the new tab block, the svg elements now use a font size defined by var(--tv-Tabs-more-icon-size) and a padding of 4px (lines 76–77). This adjustment should help improve icon legibility and balance in dark mode. Please double-check that the new values are consistent with the overall theme’s visual hierarchy.


310-317: More-Container Spacing and Positioning Revision
The &__more-container block now specifies right: 0 (line 312) and adds padding-top: 5px (line 316). These changes likely aim to improve vertical alignment and spacing in dark theme contexts. Confirm that this adjustment provides consistent alignment with other components and that the removal of any units (from "0px" to "0") does not affect rendering across browsers.


239-248: Icon-Close Hover State Update
In the .@{tabs-prefix-cls}__icon-close section, the hover state now sets background-color: transparent (line 243), effectively removing the previous background-color. This cleaner look can aid dark theme adaptation but please verify that the removal does not reduce the visual affordance for the icon’s interactivity.

packages/theme/src/steps/vars.less (1)

187-191: Vertical Dot Variables Update for Dark Theme
Several CSS custom properties for the vertical dot scenario have been updated/added:

  • --tv-Steps-dot-vertical-current-bg-color now uses var(--tv-color-border-active, #191919)
  • New undo state variables (--tv-Steps-dot-vertical-undo-border-color, --tv-Steps-dot-vertical-undo-dot-color, and --tv-Steps-dot-title-undo-text-color) have been introduced.

These changes enhance the styling for “undo” or inactive states in dark mode. Please confirm that these variables provide sufficient contrast and match the overall color palette of the dark theme.

packages/theme/src/steps/index.less (5)

698-704: Title Padding Adjustment for Enhanced Readability
In the .title class, a new padding-top: 2px; has been added (line 702). This subtle change is intended to better position the text vertically. Please confirm that this update improves readability without affecting content truncation or alignment in various layout contexts.


1027-1033: Fault State Color Variables in Vertical Dot Mode
Within the .@{steps-dot-prefix-cls} section, the fault state styling now assigns CSS variables for the left dot border and the title text:

  • The left dot’s border-color is now set to var(--tv-Steps-error-icon-color) (line 1028)
  • The title-vertical color is now var(--tv-Steps-error-text-color) (line 1032)

These changes remove hardcoded color values to better support theme variability. Please verify that the new colors provide enough emphasis for error states in a dark theme.


1036-1057: Vertical Dot Block Layout Refinement
The layout of the vertical dot blocks has been adjusted:

  • In the .block-left section, margins have been modified (margin-top: 6.5px; margin-right: 12px) (lines 1040–1042).
  • The nested .left-dot now specifies a fixed size of 10px with a border using the undo dot color (lines 1044–1048).
  • The associated .left-line also has updated margins and height calculations (lines 1052–1055).

These adjustments aim to deliver a more precise and harmonious layout for vertical dots in dark mode. Please ensure these spacing changes integrate well with adjacent UI elements.


1104-1118: Disabled State Styling in Vertical Dot Mode
In the disabled state within the vertical dot block, the styling now uses theme variables:

  • The .left-dot background and border colors are set to var(--tv-Steps-disabled-icon-bg-color) and var(--tv-Steps-disabled-border-color), respectively.
  • The text colors for .title-vertical and .description in the right block now use var(--tv-Steps-disabled-text-color) (lines 1104–1118).

This refactor ensures disabled elements are visually distinct in dark mode. Verify that the contrast and cursor ("not-allowed") behavior meet accessibility standards.


645-653: Review of .doing vs .done State Border Lines
While not marked with new diff tokens, note that within the .@{steps-prefix-cls}-block the .doing state references only the .left-line (lines 648–651), whereas both .left-line and .right-line are used in the .done state (lines 675–682). This differentiation appears intentional per dark theme adaptation guidelines. Please double-check that the removal of the right-line in the “doing” state is a deliberate design decision and does not adversely affect the visual continuity of the steps component.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9f72b19 and d0a39ef.

📒 Files selected for processing (11)
  • examples/sites/demos/pc/app/date-picker/custom-suffix-icon-composition-api.vue (1 hunks)
  • examples/sites/demos/pc/app/date-picker/custom-suffix-icon.vue (1 hunks)
  • packages/renderless/src/date-range/vue.ts (1 hunks)
  • packages/theme/src/search/index.less (1 hunks)
  • packages/theme/src/search/vars.less (1 hunks)
  • packages/theme/src/steps/index.less (5 hunks)
  • packages/theme/src/steps/vars.less (1 hunks)
  • packages/theme/src/tabs/index.less (4 hunks)
  • packages/theme/src/tabs/vars.less (1 hunks)
  • packages/vue/src/tabs/src/tab-nav/pc.vue (1 hunks)
  • packages/vue/src/upload-list/src/pc.vue (2 hunks)
🔇 Additional comments (8)
examples/sites/demos/pc/app/date-picker/custom-suffix-icon-composition-api.vue (1)

22-22: Good implementation of theme-aware styling.

The background color change from var(--tv-color-bg-active-emphasize) to var(--tv-color-bg-2) properly adapts the date picker for dark theme compatibility. This CSS variable will automatically adjust based on the active theme.

examples/sites/demos/pc/app/date-picker/custom-suffix-icon.vue (1)

30-30: Good implementation of theme-aware styling with consistent approach.

The background color change from var(--tv-color-bg-active-emphasize) to var(--tv-color-bg-2) properly adapts the date picker for dark theme compatibility. This matches the change made in the composition API version, ensuring consistent styling across different implementation approaches.

packages/renderless/src/date-range/vue.ts (1)

134-134: Improved button styling for better visibility.

Changing plain: true to plain: false for the confirmation button enhances its visibility by using a filled style instead of an outlined style. This provides better contrast, especially in dark mode where outlined buttons might be less noticeable.

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

72-73: Good addition of theme-aware variable for search icon divider.

Adding the --tv-Search-border-short-color variable with a semantic name and appropriate comment improves theme consistency. Using var(--tv-color-border-divider-short) as the value ensures the search component will properly adapt to theme changes.

packages/vue/src/tabs/src/tab-nav/pc.vue (1)

254-254: Improved padding behavior when 'more' tabs are not present.

This change improves the tabs layout by removing the unnecessary padding (previously 46px) when there are no additional tabs to display. This results in a cleaner appearance that works better in both light and dark themes.

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

113-114: Enhanced theme adaptability for search input divider.

The changes replace a hardcoded color with a CSS variable and adjust opacity for better visibility:

  1. Using var(--tv-Search-border-short-color) instead of a fixed color enables proper theme adaptation
  2. Changing opacity from partial (8%) to full (1) improves visibility in dark mode

This is a positive improvement for dark theme support.

packages/theme/src/tabs/vars.less (1)

144-144: Increased 'more' icon size for better visibility.

Increasing the icon size from 16px to 24px improves usability and visibility in dark mode, where contrast might be lower. This change enhances accessibility and creates a more balanced visual hierarchy.

packages/vue/src/upload-list/src/pc.vue (1)

338-338: Standardized error icon usage.

Replacing the custom operation failure icon with the standard error icon creates a more consistent user experience across the application. This standardization is particularly important for establishing clear visual patterns in both dark and light themes.

Also applies to: 377-377

@@ -131,7 +131,7 @@ const initState = ({ reactive, computed, api, constants, designConfig, props })
enableYearArrow: computed(() => api.computerEnableYearArrow()),
// tiny 新增
confirmButtonProps: {
plain: true,
plain: false,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

逻辑改动排查下saas主题

@zzcr zzcr merged commit a13b57e into opentiny:dev Apr 2, 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.

2 participants