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

refactor(dropdown/action-menu): [dropdown,action-menu] refactor styles for drodpwn #2343

Merged
merged 2 commits into from
Oct 22, 2024

Conversation

MomoPoppy
Copy link
Collaborator

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

  • New Features

    • Enhanced styling for action menu dropdown items, including padding and hover effects.
    • Introduced consistent border-radius properties for dropdown title and caret buttons.
  • Chores

    • Added new CSS variables for dropdown button border radii to improve customization options.

Copy link

coderabbitai bot commented Oct 21, 2024

Walkthrough

The changes in this pull request focus on enhancing the styling of the action menu and dropdown components within the theme package. Modifications include adjustments to padding, background colors, text decoration on hover for action menu items, and the introduction of border-radius properties for dropdown buttons. Additionally, new CSS variables for button border radii are defined to ensure consistency in styling across button groups.

Changes

File Path Change Summary
packages/theme/src/action-menu/index.less - Added padding to dropdown items.
- Set background color to unset on hover for non-disabled items.
- Underlined text decoration on hover for dropdown items.
packages/theme/src/dropdown/index.less - Added border-radius to .dropdown-prefix-cls__title-button and .dropdown-prefix-cls__caret-button classes.
packages/theme/src/dropdown/vars.less - Introduced new CSS variables: --tv-Dropdown-caret-button-border-radius and --tv-Dropdown-title-button-border-radius.

Possibly related PRs

Suggested labels

refactoring

Suggested reviewers

  • zzcr

Poem

In the meadow where the dropdowns sway,
A rabbit hops with joy today.
With borders rounded, colors bright,
Action menus dance in delight!
Padding added, hover's grace,
A stylish feast in this happy place! 🐇✨


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

@MomoPoppy MomoPoppy changed the title Momo poppy/refactor action menu 1021 refactor(dropdown/action-menu): [dropdown,action-menu] refactor styles for drodpwn Oct 21, 2024
@github-actions github-actions bot added the refactoring Refactoring (重构) label Oct 21, 2024
@MomoPoppy
Copy link
Collaborator Author

image
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: 1

🧹 Outside diff range and nitpick comments (1)
packages/theme/src/dropdown/vars.less (1)

38-43: LGTM! Consider minor formatting adjustment for readability.

The new CSS variables for button border radii in button groups are well-implemented and consistent with the existing styling patterns. They provide a nice rounded effect for button groups and allow for easy theming.

Consider adjusting the formatting slightly for better readability:

-  --tv-Dropdown-caret-button-border-radius: 0 var(--tv-border-radius-round, 999px) var(--tv-border-radius-round, 999px)
-    0;
+  --tv-Dropdown-caret-button-border-radius: 
+    0 
+    var(--tv-border-radius-round, 999px) 
+    var(--tv-border-radius-round, 999px) 
+    0;

-  --tv-Dropdown-title-button-border-radius: var(--tv-border-radius-round, 999px) 0 0
-    var(--tv-border-radius-round, 999px);
+  --tv-Dropdown-title-button-border-radius: 
+    var(--tv-border-radius-round, 999px) 
+    0 
+    0 
+    var(--tv-border-radius-round, 999px);

This formatting makes it easier to read the four values of the border-radius property at a glance.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 3175340 and 0ed6338.

📒 Files selected for processing (3)
  • packages/theme/src/action-menu/index.less (2 hunks)
  • packages/theme/src/dropdown/index.less (1 hunks)
  • packages/theme/src/dropdown/vars.less (1 hunks)
🧰 Additional context used
🔇 Additional comments (6)
packages/theme/src/action-menu/index.less (3)

40-41: LGTM: Padding adjustment for visible dropdown items.

The removal of padding for visible dropdown items creates a more compact layout. This change appears intentional and aligns with the refactoring objectives.


58-60: LGTM: Enhanced hover feedback with underline.

Adding an underline to the dropdown item wrap on hover improves the user experience by providing clear visual feedback. This change enhances accessibility and is consistent with common web design patterns.


Line range hint 40-60: Summary: Improved styling and interaction for action menu items.

The changes in this file enhance the action menu component by:

  1. Adjusting padding for a more compact layout.
  2. Removing the background color on hover for a cleaner look.
  3. Adding an underline on hover for better visual feedback.

These modifications align well with the PR's refactoring objectives and should improve the overall user experience. However, please ensure that the hover state remains sufficiently visible after removing the background color change.

packages/theme/src/dropdown/index.less (3)

77-77: LGTM: Improved styling for the dropdown title button

The addition of the border-radius property using the --tv-Dropdown-title-button-border-radius variable enhances the visual consistency of the dropdown component and allows for easy customization.


85-86: LGTM: Enhanced styling for the dropdown caret button

The changes improve the visual consistency of the dropdown component:

  1. The addition of the border-radius property using the --tv-Dropdown-caret-button-border-radius variable allows for easy customization.
  2. Setting margin-left: 0 ensures proper alignment with the title button.

These modifications contribute to a more polished and cohesive appearance of the dropdown component.


77-86: Summary: Improved styling and customization for dropdown buttons

The changes in this file enhance the dropdown component's appearance and flexibility:

  1. Added border-radius properties for both the title and caret buttons.
  2. Utilized CSS variables for easy customization.
  3. Ensured proper alignment between the title and caret buttons.

These modifications align well with the PR's refactoring objectives and contribute to a more polished and consistent user interface.

Comment on lines +55 to +57
.@{dropdown-item-prefix-cls} {
background-color: unset;

Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

Removing background color on hover eliminates visual feedback for menu items.

The background color for non-disabled dropdown items is unset on hover without any alternative visual indicators. This can reduce the clarity of interactions for users. Consider adding another form of visual feedback to ensure a clear and intuitive user experience.

🔗 Analysis chain

Verify hover state visibility after background color removal.

Setting the background color to 'unset' on hover for non-disabled dropdown items removes the visual feedback users might expect when interacting with the menu. While this change aligns with the refactoring goals, please ensure that there's still sufficient visual indication when users hover over menu items.

To verify the hover state visibility, you can run the following command to check if there are any other hover effects applied to these elements:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for other hover effects on dropdown items
rg -i '(hover|:hover)' packages/theme/src/action-menu/

Length of output: 134


Script:

#!/bin/bash
# Description: Extract styles applied to &:not(.is-disabled):hover
rg -A 5 '^&:not\(.is-disabled\):hover\s*{' packages/theme/src/action-menu/index.less

Length of output: 214


Script:

#!/bin/bash
# Description: Extract styles applied to &:not(.is-disabled):hover with corrected regex
rg -A 5 '^&:not\(.is-disabled\):hover\s*\{' packages/theme/src/action-menu/index.less

Length of output: 87

@zzcr zzcr merged commit e8b8bab into opentiny:dev Oct 22, 2024
13 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Refactoring (重构)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants