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(date-picker): [date-picker,select] fix radius bugs for month-table #2442

Merged

Conversation

MomoPoppy
Copy link
Collaborator

@MomoPoppy MomoPoppy commented Oct 28, 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

    • Enhanced month table styling with distinct border-radius for the first and last rows.
    • Introduced new props in the select component for improved functionality, including searchable dropdowns and conditional image display when no data is available.
  • Bug Fixes

    • Improved visual presentation of tooltips and select component states (disabled, clicked).
  • Style

    • Refined styles for select component, including adjustments for SVG icons and tooltip maximum width.

Copy link

coderabbitai bot commented Oct 28, 2024

Walkthrough

The changes in this pull request involve updates to various styles and functionalities across multiple components. The .month-table class in index.less receives new border-radius styles for the first and last rows. New CSS custom properties for these styles are introduced in vars.less. The select component's styles are refined, particularly for its disabled state and tooltips. Lastly, enhancements to the pc.vue component include new props for improved functionality, such as search capabilities and conditional rendering for tags and dropdowns.

Changes

File Path Change Summary
packages/theme/src/month-table/index.less Added border-radius styles for the first and last rows of the month table.
packages/theme/src/month-table/vars.less Introduced new CSS custom properties for border-radius of the first and last cells in the month table.
packages/theme/src/select/index.less Modified styles for .tiny-svg, is-disabled, and is-display-only states; added tooltip width limit.
packages/vue/src/select/src/pc.vue Added multiple new props to enhance functionality, including searchable, showEmptyImage, and others.

Possibly related PRs

Suggested labels

bug

Suggested reviewers

  • zzcr
  • gimmyhehe

🐰 In the meadow where the flowers bloom,
The month table shines, dispelling gloom.
With borders rounded, oh so neat,
A select component, now a treat!
New props added, search with glee,
Hopping along, come play with me! 🌼✨


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.

@github-actions github-actions bot added the bug Something isn't working label Oct 28, 2024
@MomoPoppy
Copy link
Collaborator Author

image

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


image

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 (3)
packages/theme/src/month-table/vars.less (1)

37-41: LGTM! The new border-radius variables are well-defined.

The new CSS custom properties are properly named, documented, and maintain consistency with existing variables.

Consider adjusting the line breaks for consistency with other similar properties:

-  --tv-MonthTable-cell-border-radius-first: var(--tv-border-radius-round, 999px) 0 0
-    var(--tv-border-radius-round, 999px);
+  --tv-MonthTable-cell-border-radius-first: var(--tv-border-radius-round, 999px) 0 0 var(--tv-border-radius-round, 999px);
packages/theme/src/month-table/index.less (1)

96-113: LGTM! Consider adding RTL support.

The border-radius implementation for first and last rows looks correct and aligns with the PR objective. However, consider adding RTL support for the padding adjustments.

Add RTL support by using logical properties:

        &.end-date {
          div {
            border-radius: var(--tv-MonthTable-cell-border-radius);
-           padding-left: 0;
+           padding-inline-start: 0;
          }
        }
packages/theme/src/select/index.less (1)

Line range hint 368-370: Consider using a CSS custom property for tooltip max-width.

While setting a max-width for tooltips is good practice, consider making this value configurable via a CSS custom property for better theme customization.

-  max-width: 300px;
+  max-width: var(--tv-Select-tooltip-max-width, 300px);

Don't forget to add the new variable to vars.less:

--tv-Select-tooltip-max-width: 300px;
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 38839af and ab7e698.

📒 Files selected for processing (4)
  • packages/theme/src/month-table/index.less (1 hunks)
  • packages/theme/src/month-table/vars.less (1 hunks)
  • packages/theme/src/select/index.less (1 hunks)
  • packages/vue/src/select/src/pc.vue (1 hunks)
🔇 Additional comments (5)
packages/theme/src/month-table/vars.less (1)

37-41: Verify the usage of new border-radius variables.

Let's ensure these new variables are properly utilized in the corresponding Less files.

✅ Verification successful

Border radius variables are properly implemented and used

The variables are correctly defined in vars.less and properly utilized in index.less for styling the first and last cells of the month table rows.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the new border-radius variables are used in the month-table styles

# Test: Search for the usage of new border-radius variables
rg --type less "tv-MonthTable-cell-border-radius-(first|last)"

Length of output: 580

packages/theme/src/month-table/index.less (1)

98-98: Verify the new CSS custom properties.

The implementation uses two new custom properties: --tv-MonthTable-cell-border-radius-first and --tv-MonthTable-cell-border-radius-last.

Let's verify these are properly defined:

Also applies to: 111-111

✅ Verification successful

Custom properties are properly defined and used correctly

The verification shows that both custom properties --tv-MonthTable-cell-border-radius-first and --tv-MonthTable-cell-border-radius-last are:

  • Properly defined in packages/theme/src/month-table/vars.less
  • Used correctly in packages/theme/src/month-table/index.less
  • Follow the fallback pattern using --tv-border-radius-round with a default value
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the new CSS custom properties are defined in vars.less
rg --type less "tv-MonthTable-cell-border-radius-(first|last)" packages/theme/src/

Length of output: 600

packages/theme/src/select/index.less (2)

Line range hint 348-366: LGTM! Improved disabled state handling.

The changes properly handle disabled states by:

  • Setting consistent cursor styles
  • Adjusting padding for better visual appearance
  • Ensuring proper suffix display

344-347: Verify the visual alignment after margin removal.

The removal of right margin from SVG icons in the click-expand state could affect the spacing between the icon and adjacent elements. Please ensure this doesn't create any visual alignment issues, especially in different states (hover, focus, etc.).

✅ Verification successful

Based on the search results, I can now provide a final response:

SVG margin removal is consistent with component's design

The margin removal for .tiny-svg within the .is-click-expand state is intentional and correct. The codebase shows that:

  1. The select component has specific handling for SVG icons in different states
  2. In the click-expand state, the component uses absolute positioning for tags and requires precise control over spacing
  3. Other SVG margins in the select and select-dropdown components are explicitly defined where needed (e.g., margin: var(--tv-Select-collapse-margin) in normal state)
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any related margin or spacing styles for SVG icons
rg -l "tiny-svg.*margin|margin.*tiny-svg" --type less

Length of output: 55


Script:

#!/bin/bash
# Let's try a broader search for SVG-related styles in the select component
rg "tiny-svg" --type less -A 2 -B 2

Length of output: 18665


Script:

#!/bin/bash
# Search for any margin-related styles within the select component
fd "select.*\.less$" --exec rg "margin" {} -A 2 -B 2

Length of output: 54


Script:

#!/bin/bash
# Look for the specific class context
rg "is-click-expand" --type less -A 5 -B 5

Length of output: 2536

packages/vue/src/select/src/pc.vue (1)

159-159: Verify the usage of the only-icon prop in <tiny-tag>

Please confirm that the only-icon prop is supported by the <tiny-tag> component and is implemented correctly.

Run the following script to verify if the only-icon prop is defined in the <tiny-tag> component's props:

✅ Verification successful

Based on the code analysis, I can now provide the final response:

The only-icon prop is properly supported by the tiny-tag component

The verification shows that the only-icon prop is correctly defined in the tag component's props list (line 41 in packages/vue/src/tag/src/pc.vue) and is properly handled in the component's rendering logic to apply the CSS class tiny-tag--only-icon when enabled (line 89).

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if 'only-icon' is a valid prop in 'tiny-tag' component.

# Expected result: The 'only-icon' prop should be declared in the props of 'tiny-tag'.

# Search for the 'only-icon' prop declaration in 'tiny-tag' component files.
fd --type f --name '*.vue' | xargs rg -A 5 -F "export default" | rg -A 10 "tiny-tag" | rg -A 5 "props" | rg "only-icon"

Length of output: 366


Script:

#!/bin/bash
# Let's first find the tiny-tag component file
fd tiny-tag

# Then let's search for the props definition in the tiny-tag component
rg -A 10 "props:\s*{" --type vue

# Also search for any TypeScript interface or type definitions for tiny-tag props
rg -A 10 "interface.*TagProps|type.*TagProps" --type typescript

Length of output: 233


Script:

#!/bin/bash
# First, let's find the tiny-tag component file
fd "tiny-tag"

# Then let's search for props definition with fixed regex
rg -A 10 "props: {" 

# Also search for any files containing tiny-tag to understand its implementation
rg -l "tiny-tag"

Length of output: 7260


Script:

#!/bin/bash
# Let's examine the tag component's source code
cat packages/vue/src/tag/src/pc.vue

# And also check the select component where only-icon is being used
cat packages/vue/src/select/src/pc.vue

Length of output: 31933

@zzcr zzcr merged commit 0fb2966 into opentiny:release-3.19.0 Oct 28, 2024
15 of 24 checks passed
zzcr added a commit that referenced this pull request Oct 28, 2024
* fix(build): fix build error

* fix(docs): 增加上传文件类型说明 (#2439)

* fix(tag): update tag's size when only icon, update one place of  button's icon size (#2440)

* fix(date-picker): [date-picker,select] fix radius bugs for month-table (#2442)

* docs(site): fix demos and test e2e (#2444)

* test(site): fix icon not correct test e2e (#2445)

---------

Co-authored-by: chenxi-20 <[email protected]>
Co-authored-by: 申君健 <[email protected]>
Co-authored-by: MomoPoppy <[email protected]>
Co-authored-by: gimmyhehe <[email protected]>
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.

3 participants