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(button): [button] Adapting to the SMB theme #2120

Merged
merged 5 commits into from
Sep 13, 2024

Conversation

Youyou-smiles
Copy link
Collaborator

@Youyou-smiles Youyou-smiles commented Sep 13, 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
    • Introduced a new CSS variable for ghost button text color, enhancing customization.
  • Visual Updates
    • Updated button styles for disabled and ghost states, improving visual clarity.
    • Adjusted colors for various button types to align with new design guidelines.
    • Modified button sizes for better consistency across the application.
  • Refinements
    • Enhanced hover and disabled state styles for a more cohesive user experience.

Copy link

coderabbitai bot commented Sep 13, 2024

Walkthrough

The pull request introduces several updates to button styles across various test files and CSS variables. Key changes include modifications to the expected CSS properties for button states, such as disabled and ghost buttons, as well as adjustments to button sizes and text colors. New CSS variables are introduced for better theming, and existing variables are updated to standardize button appearances. Additionally, a loading icon component is renamed to enhance visual representation.

Changes

File Path Change Summary
examples/sites/demos/pc/app/button/*.spec.ts Updated expected CSS properties for button elements, including disabled and ghost states, with changes to background, text, and border colors. Adjusted button sizes.
packages/theme/src/button/index.less Added a new CSS variable for ghost button text color, enhancing theming flexibility.
packages/theme/src/button/vars.less Modified button styling variables, including font sizes, heights, and colors for various button states, ensuring consistency across the application.
packages/vue/src/button/src/pc.vue Renamed loading icon component from iconLoading to iconLoadingShadow, updating the component registration accordingly.

Possibly related PRs

Suggested labels

enhancement

Poem

🐇 In a world of buttons, bright and new,
Colors and styles, a splendid view.
Disabled and ghostly, they stand so tall,
With tweaks and changes, they’ll charm us all.
So hop along, let’s celebrate,
A button’s journey, oh, isn’t it great! 🎉

Tip

OpenAI O1 model for chat
  • We have deployed OpenAI's latest O1 model for chat.
  • OpenAI claims that this model has superior reasoning capabilities than their GPT-4o model.
  • Please share any feedback with us in the discussions post.

Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 37f275f and af7f382.

Files selected for processing (7)
  • examples/sites/demos/pc/app/button/dynamic-disabled.spec.ts (1 hunks)
  • examples/sites/demos/pc/app/button/ghost.spec.ts (1 hunks)
  • examples/sites/demos/pc/app/button/size.spec.ts (1 hunks)
  • examples/sites/demos/pc/app/button/text.spec.ts (1 hunks)
  • packages/theme/src/button/index.less (1 hunks)
  • packages/theme/src/button/vars.less (6 hunks)
  • packages/vue/src/button/src/pc.vue (2 hunks)
Additional comments not posted (31)
examples/sites/demos/pc/app/button/text.spec.ts (1)

16-17: LGTM!

The updates to the expected CSS color properties for the buttons at index 2 and 4 align with the PR objective of adapting the button component to the SMB theme. The changes are localized to the test case and do not introduce any breaking changes.

examples/sites/demos/pc/app/button/size.spec.ts (2)

17-17: LGTM!

The change to the expected height of the small button from '32px' to '28px' aligns with the information provided in the AI-generated summary. The test assertion has been updated correctly to reflect this change.


18-18: LGTM!

The change to the expected height of the default button from '28px' to '32px' aligns with the information provided in the AI-generated summary. The test assertion has been updated correctly to reflect this change.

examples/sites/demos/pc/app/button/dynamic-disabled.spec.ts (4)

13-15: LGTM!

The updated background color, text color, and border color for the disabled .tiny-button element align with the PR objective of adapting to the SMB theme. The lighter background color, lower contrast text color, and matching border color enhance the visual representation of the disabled state.


19-19: LGTM!

The updated text color for the disabled ghost button aligns with the PR objective of adapting to the SMB theme. The lower contrast text color enhances the visual representation of the disabled state.


21-21: LGTM!

The updated border color for the disabled ghost button aligns with the PR objective of adapting to the SMB theme. The lighter border color enhances the visual representation of the disabled state.


Line range hint 1-12:

Also applies to: 16-18, 22-30

packages/vue/src/button/src/pc.vue (2)

47-47: LGTM!

The import statement change from iconLoading to iconLoadingShadow aligns with the PR objective of adapting the button component to the SMB theme. The new icon name suggests an enhanced loading indicator with a shadow effect, potentially improving the visual representation of the loading state.


71-71: Looks good!

The component registration update from IconLoading: iconLoading() to IconLoading: iconLoadingShadow() is consistent with the updated import statement. This change ensures that the new loading icon is correctly registered and used within the button component.

examples/sites/demos/pc/app/button/ghost.spec.ts (12)

11-13: LGTM!

The changes to the expected CSS properties for the primary ghost button are consistent with the overall button style redesign mentioned in the PR summary. The new color scheme looks good.


17-19: Looks good!

The updated CSS properties for the primary ghost button's clicked state match the changes made to its default state. The consistency is maintained.


23-25: Nice update!

The secondary ghost button now features a consistent gray color scheme, as mentioned in the PR summary. The changes look good and maintain consistency.


29-31: Looks good!

The updated CSS properties for the secondary ghost button's clicked state match the changes made to its default state. The consistency is maintained.


34-36: Great color choice!

The success ghost button now features a vibrant green color, as mentioned in the PR summary. The change enhances the visual representation of the success state.


40-42: Looks good!

The updated CSS properties for the success ghost button's clicked state match the changes made to its default state. The consistency is maintained.


45-47: Nice color update!

The info ghost button now features a brighter blue color, as mentioned in the PR summary. The change enhances the visual representation of the info state.


51-53: Looks good!

The updated CSS properties for the info ghost button's clicked state match the changes made to its default state. The consistency is maintained.


56-58: Great color choice!

The warning ghost button now features a vibrant orange color, as mentioned in the PR summary. The change enhances the visual representation of the warning state.


62-64: Looks good!

The updated CSS properties for the warning ghost button's clicked state match the changes made to its default state. The consistency is maintained.


67-69: Great color choice!

The danger ghost button now features a vibrant red color, as mentioned in the PR summary. The change enhances the visual representation of the danger state.


73-75: Looks good!

The updated CSS properties for the danger ghost button's clicked state match the changes made to its default state. The consistency is maintained.

packages/theme/src/button/vars.less (9)

26-26: LGTM!

The change to reduce the font size of loading buttons looks good.


107-108: LGTM!

The new --ti-button-plain-hover-border-color variable looks good. It provides a new styling option for plain buttons on hover.


313-313: LGTM!

The change to update the text color of ghost buttons to a fixed #595959 color looks good. It will make the text color consistent across the application.


317-317: LGTM!

The change to update the hover text color of ghost buttons to #595959 looks good. It will make the hover text color consistent with the regular text color of ghost buttons.


319-319: LGTM!

The change to update the hover border color of ghost buttons to #DBDBDB looks good. It's a minor color adjustment.


323-323: LGTM!

The change to update the disabled border color of ghost buttons to #DBDBDB looks good. It's just a case change and will not have any visual impact.


445-445: Verify the impact of changing the icon-only button border radius.

The change to update the border radius of icon-only buttons to var(--ti-common-border-radius-3) looks good.

However, please verify that this change aligns with the design specs and does not adversely impact the aesthetics or usability of icon-only buttons. Run the following script to find usages of the --ti-button-only-icon-border-radius variable:

Verification successful

Verified: Icon-only button border radius change is applied correctly

The change to update the border radius of icon-only buttons to var(--ti-common-border-radius-3) is correctly applied and used in the codebase. The variable --ti-button-only-icon-border-radius is utilized in packages/theme/src/button/index.less to set the border-radius property of icon-only buttons.

While the code implementation is correct, it's recommended to:

  • Visually inspect the change in a development environment to ensure it meets the design requirements.
  • Confirm with the design team that this update aligns with the intended user interface specifications.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Find usages of the `--ti-button-only-icon-border-radius` variable.

# Test: Search for the variable usage. Expect: Review the results to ensure the border radius change aligns with the design.
rg --type less $'--ti-button-only-icon-border-radius' -g '!vars.less'

Length of output: 506


Script:

#!/bin/bash
# Description: Find usages of the `--ti-button-only-icon-border-radius` variable.

# Test: Search for the variable usage. Expect: Review the results to ensure the border radius change aligns with the design.
rg --type less '\-\-ti-button-only-icon-border-radius' -g '!vars.less'

Length of output: 170


60-60: Verify the impact of changing the small button height.

The change to reduce the height of small buttons to a fixed 28px looks good as it will make the height consistent across the application.

However, please verify that this change does not adversely impact the layout or appearance of any pages or components using small buttons. Run the following script to find usages of the --ti-button-size-small-height variable:

Verification successful

Approve the change to small button height, with a recommendation for manual verification.

The change to set --ti-button-size-small-height to 28px appears to be safe. There are no direct usages of this variable found in other files, which suggests that the impact is limited to the button component itself. The value of 28px is used in various other components for different purposes, but not in a way that would conflict with this change.

However, to ensure the best user experience:

  • Manually verify the appearance of small buttons in the application UI.
  • Check that the new height integrates well with other components and layouts.
  • Consider testing in different screen sizes and resolutions to confirm responsiveness.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Find usages of the `--ti-button-size-small-height` variable.

# Test: Search for the variable usage. Expect: Review the results to ensure the change does not break any styles.
rg --type less $'--ti-button-size-small-height' -g '!vars.less'

Length of output: 494


Script:

#!/bin/bash
# Description: Find usages of the `--ti-button-size-small-height` variable and '28px' value

# Search for the variable usage
echo "Searching for --ti-button-size-small-height:"
rg --type less '--ti-button-size-small-height' -g '!vars.less' -C 2

# Search for the new value (28px) in case it's hardcoded elsewhere
echo -e "\nSearching for 28px:"
rg --type less '28px' -g '!vars.less' -C 2

Length of output: 13659


355-355: Verify the impact of changing the info ghost button hover border color.

The change to update the hover border color of info ghost buttons to #DEECFF looks good.

However, please verify that this color change aligns with the design specs and does not adversely impact the aesthetics or usability of info ghost buttons on hover. Run the following script to find usages of the --ti-button-info-ghost-hover-border-color variable:

Verification successful

Verified: The color change for info ghost button hover border is consistent with the design system.

The update to the --ti-button-info-ghost-hover-border-color variable from #FAFAFA to #DEECFF is part of a cohesive design system for info-related button styles. This change:

  1. Aligns with other info button styles, such as the plain border color.
  2. Is used consistently within the button component.
  3. Does not impact other parts of the UI outside of buttons.

The change is isolated to the button component and maintains consistency with related color variables. No further action is required.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Find usages of the `--ti-button-info-ghost-hover-border-color` variable.

# Test: Search for the variable usage. Expect: Review the results to ensure the color change aligns with the design.
rg --type less $'--ti-button-info-ghost-hover-border-color' -g '!vars.less'

Length of output: 518


Script:

#!/bin/bash
# Description: Find usages of the `--ti-button-info-ghost-hover-border-color` variable and its new color value.

# Search for the variable usage
echo "Searching for --ti-button-info-ghost-hover-border-color variable usage:"
rg --type less -e '--ti-button-info-ghost-hover-border-color' -g '!vars.less'

# Search for the new color value
echo -e "\nSearching for #DEECFF color usage:"
rg --type less -e '#DEECFF' -g '!vars.less'

# List all .less files to ensure we're searching in the right place
echo -e "\nListing all .less files in the repository:"
fd -e less

Length of output: 30841


Script:

#!/bin/bash
# Description: Find any other references to the variable and related color values

# Search for the variable name
echo "Searching for other references to --ti-button-info-ghost-hover-border-color:"
rg --type less '--ti-button-info-ghost-hover-border-color'

# Search for similar color variables
echo -e "\nSearching for similar color variables:"
rg --type less -i '(--ti-button-info.*color|--ti-button.*ghost.*color)'

# Search for the old and new color values
echo -e "\nSearching for the old (#FAFAFA) and new (#DEECFF) color values:"
rg --type less -e '#FAFAFA' -e '#DEECFF'

Length of output: 10571

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

107-107: LGTM!

The new CSS variable --ti-button-ghost-text-color for the ghost button text color enhances theming flexibility. The variable name follows a clear naming convention, making it easy to understand its purpose.


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 enhancement New feature or request (功能增强) label Sep 13, 2024
@zzcr zzcr merged commit 6dd6aa1 into opentiny:dev Sep 13, 2024
7 checks passed
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.

2 participants