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

Merged
merged 6 commits into from
Sep 9, 2024

Conversation

Youyou-smiles
Copy link
Collaborator

@Youyou-smiles Youyou-smiles commented Sep 9, 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 button group layout with improved organization and styling.
    • Introduced new size options (medium, small, mini) for button groups.
    • Updated button text to align with new design specifications.
  • Bug Fixes

    • Removed outdated demo entries to streamline documentation.
  • Style

    • Added new CSS styles for button sizes and improved hover effects.
    • Updated styling rules for better visual consistency and responsiveness.
  • Documentation

    • Updated documentation to reflect changes in button group features and styling options.

Copy link

coderabbitai bot commented Sep 9, 2024

Walkthrough

The pull request introduces significant updates to the button group components in a Vue.js application. It restructures templates, modifies data properties for button labels, and enhances styling for various button sizes. Additionally, it removes an outdated demo entry from the documentation and refines the rendering logic by eliminating inline styles. These changes collectively aim to improve the organization, functionality, and visual presentation of the button group components.

Changes

Files Change Summary
examples/sites/demos/pc/app/button-group/sup-composition-api.vue Restructured template with new <div> wrappers, updated button labels in groupData and groupDataTag, and added new CSS rules for styling.
examples/sites/demos/pc/app/button-group/sup.vue Enhanced layout with new wrappers, modified button labels in groupData and groupData2, and adjusted styling for various elements.
examples/sites/demos/pc/app/button-group/webdoc/button-group.js Removed demo entry related to the "border" feature, streamlining documentation.
packages/renderless/src/button-group/index.ts Updated getItemClass function to return additional size properties when props.plain is true.
packages/renderless/types/button-group.type.ts Added optional properties for button sizes (medium, small, mini) to IButtonGroupItemClass interface.
packages/theme/src/button-group/index.less Introduced new styles for button sizes (&&--medium, &&--small, &&--mini) to enhance button group flexibility.
packages/theme/src/button-group/smb-theme.js Modified tinyButtonGroupTheme to include new size properties and fixed color values for hover and disabled states.
packages/theme/src/button-group/vars.less Added CSS custom properties for button sizes and line heights to improve design flexibility.
packages/vue/src/button-group/src/pc.vue Removed inline styles for button sizes, shifting styling control to external CSS.

Possibly related PRs

Suggested labels

developing

Poem

🐰 In a world of buttons, bright and new,
A hop, a skip, a change or two!
With colors bold and sizes grand,
Our button groups now take a stand.
So let us cheer, with joy and glee,
For every click, a jubilee! 🎉

Tip

New features

Walkthrough comment now includes:

  • Possibly related PRs: A list of potentially related PRs to help you recall past context.
  • Suggested labels: CodeRabbit can now suggest labels by learning from your past PRs. You can also provide custom labeling instructions in the UI or configuration file.

Notes:

  • Please share any feedback in the discussion post on our Discord.
  • Possibly related PRs, automatic label suggestions based on past PRs, learnings, and possibly related issues require data opt-in (enabled by default).

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.

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 363e730 and fff1aa5.

Files selected for processing (9)
  • examples/sites/demos/pc/app/button-group/sup-composition-api.vue (6 hunks)
  • examples/sites/demos/pc/app/button-group/sup.vue (6 hunks)
  • examples/sites/demos/pc/app/button-group/webdoc/button-group.js (1 hunks)
  • packages/renderless/src/button-group/index.ts (1 hunks)
  • packages/renderless/types/button-group.type.ts (1 hunks)
  • packages/theme/src/button-group/index.less (1 hunks)
  • packages/theme/src/button-group/smb-theme.js (2 hunks)
  • packages/theme/src/button-group/vars.less (1 hunks)
  • packages/vue/src/button-group/src/pc.vue (1 hunks)
Files skipped from review due to trivial changes (2)
  • examples/sites/demos/pc/app/button-group/webdoc/button-group.js
  • packages/vue/src/button-group/src/pc.vue
Additional comments not posted (13)
packages/renderless/types/button-group.type.ts (1)

11-13: Approved: New size properties added to IButtonGroupItemClass.

The addition of medium, small, and mini properties as optional booleans is a good enhancement for theme flexibility. Ensure that these new properties are consistently used wherever IButtonGroupItemClass is utilized.

Verification successful

Verified: Consistent use of new size properties in IButtonGroupItemClass.

The properties medium, small, and mini are consistently used across the codebase, including in the logic for handling button group sizes in packages/renderless/src/button-group/index.ts. This confirms their integration and usage as intended.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistent use of new size properties across the codebase.

# Test: Search for the interface usage and check for property handling.
rg --type ts -A 5 $'IButtonGroupItemClass'

Length of output: 1425


Script:

#!/bin/bash
# Description: Search for the usage of new size properties in the codebase.

# Test: Search for occurrences of the properties `medium`, `small`, and `mini`.
rg --type ts 'medium' -A 3
rg --type ts 'small' -A 3
rg --type ts 'mini' -A 3

Length of output: 164503

packages/theme/src/button-group/smb-theme.js (1)

Line range hint 8-26: Approved: New theme properties for button group sizes and colors.

The addition of new size and color properties in tinyButtonGroupTheme enhances the theme's flexibility and customization options. Ensure that these properties are consistently used in the component styling and that they align with the overall design guidelines.

packages/renderless/src/button-group/index.ts (1)

51-58: Approved: Enhanced getItemClass function with size properties.

The modifications to include medium, small, and mini properties based on props.size in the getItemClass function enhance its functionality and theme adaptability. Verify that the size property is consistently handled across all relevant parts of the codebase.

Verification successful

Verified: Consistent handling of size property across the codebase.

The size property is consistently used across various components in the codebase, including conditional logic and computed properties. The changes in button-group/index.ts align with this pattern, confirming the correctness and consistency of the modifications.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistent handling of the `size` property across the codebase.

# Test: Search for the `size` property usage and check for consistent handling.
rg --type ts -A 5 $'props.size'

Length of output: 18845

examples/sites/demos/pc/app/button-group/sup-composition-api.vue (3)

124-140: Style adjustments approved.

The new CSS rules for the .sup and .tag classes enhance the layout and responsiveness of the component. Ensure that these style changes are consistent with the overall design guidelines of the SMB theme.


Line range hint 38-91: Data properties modifications approved.

The changes to groupData and groupDataTag align with the new requirements or design specifications for the SMB theme. Verify that these data changes integrate seamlessly with the backend and other components that depend on this data.

Run the following script to verify the data integration:

Verification successful

Integration of groupData and groupDataTag verified.

The data properties groupData and groupDataTag are consistently used across multiple .vue files, particularly within <tiny-button-group> components. This confirms that the changes in the sup-composition-api.vue file are well-integrated with the rest of the codebase. No issues were found with their usage.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the integration of the data changes with the backend and other components.

# Test: Search for the data usage. Expect: Consistent data usage across related components.
rg --type vue -A 5 $'groupData'

Length of output: 58


Script:

#!/bin/bash
# Corrected command to verify the integration of the data changes with the backend and other components.

# Test: Search for the data usage. Expect: Consistent data usage across related components.
rg --type vue -A 5 'groupData|groupDataTag'

Length of output: 73


Script:

#!/bin/bash
# Use fd to find .vue files and pipe them to rg to search for groupData and groupDataTag.

# Find all .vue files and search for the data usage.
fd --extension vue --exec rg -A 5 'groupData|groupDataTag'

Length of output: 14713


4-24: Template restructuring approved.

The changes to the template structure enhance the organization and visual presentation of the component. Ensure that these changes integrate well with the overall SMB theme and do not introduce any visual inconsistencies.

Run the following script to verify the integration with the SMB theme:

examples/sites/demos/pc/app/button-group/sup.vue (3)

135-150: Style adjustments approved.

The new CSS rules for the .sup and .tag classes enhance the layout and responsiveness of the component. Ensure that these style changes are consistent with the overall design guidelines of the SMB theme.


Line range hint 45-98: Data properties modifications approved.

The changes to groupData and groupData2 align with the new requirements or design specifications for the SMB theme. Verify that these data changes integrate seamlessly with the backend and other components that depend on this data.

Run the following script to verify the data integration:

Verification successful

Data properties groupData and groupData2 are well-integrated across the codebase.

The data changes in sup.vue are consistent with their usage in other components, indicating successful integration. The modifications align with the existing structure and functionality of the application.

  • groupData is used in multiple components, ensuring consistency.
  • groupData2 is specifically utilized in sup.vue, showing targeted application.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the integration of the data changes with the backend and other components.

# Test: Search for the data usage. Expect: Consistent data usage across related components.
rg --type vue -A 5 $'groupData'

Length of output: 58


Script:

#!/bin/bash
# Description: Verify the integration of the data changes with the backend and other components.

# Test: Search for the data usage in .vue files. Expect: Consistent data usage across related components.
rg 'groupData' --glob '*.vue' -A 5
rg 'groupData2' --glob '*.vue' -A 5

Length of output: 44276


4-24: Template restructuring approved.

The changes to the template structure enhance the organization and visual presentation of the component. Ensure that these changes integrate well with the overall SMB theme and do not introduce any visual inconsistencies.

Run the following script to verify the integration with the SMB theme:

packages/theme/src/button-group/vars.less (1)

121-126: New CSS custom properties approved.

The addition of new variables for button group sizing enhances the flexibility and design capabilities of the component. Verify that these new variables are being used consistently across the project to maintain uniformity in button sizing and layout.

Run the following script to verify the usage of the new variables:

Verification successful

New CSS custom properties are being used consistently.

The new variables for button group sizing are utilized in the packages/theme/src/button-group/index.less file, confirming their integration into the project's styling logic. This supports the goal of enhancing flexibility and design capabilities for button groups.

  • File: packages/theme/src/button-group/index.less
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of new CSS custom properties across the project.

# Test: Search for the new variables usage. Expect: Consistent usage across the project.
rg --type less -A 5 $'--ti-button-group-'

Length of output: 461


Script:

#!/bin/bash
# Description: Verify the usage of new CSS custom properties across the project.

# Test: Search for the new variables usage. Expect: Consistent usage across the project.
rg --type less -A 5 '--ti-button-group-'

Length of output: 461


Script:

#!/bin/bash
# Description: Verify the usage of new CSS custom properties across the project.

# Test: Search for the new variables usage. Expect: Consistent usage across the project.
rg --type less -A 5 '\-\-ti-button-group-'

Length of output: 28451

packages/theme/src/button-group/index.less (3)

323-328: Review: New medium size styles for button group.

The new styles for the medium size buttons within the button group are correctly implemented using CSS variables for height and line-height. This ensures consistency and ease of maintenance. However, ensure that these variables (--ti-button-group-medium-size and --ti-button-group-medium-line-height) are defined in the imported vars.less or another relevant file to avoid runtime errors.

Verification successful

CSS Variables for Medium Size Button Group are Defined

The CSS variables --ti-button-group-medium-size and --ti-button-group-medium-line-height are correctly defined in the vars.less file, ensuring that the new styles for the medium size button group will function as intended. No further action is needed.

  • --ti-button-group-medium-size: 42px;
  • --ti-button-group-medium-line-height: 40px;
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the CSS variables for medium size are defined.

# Test: Search for the variable definitions in the vars.less file. Expect: Definitions for the variables used.
rg --type less --files-with-matches $'--ti-button-group-medium-size|--ti-button-group-medium-line-height' packages/theme/src/button-group/vars.less

Length of output: 617


Script:

#!/bin/bash
# Description: Verify that the CSS variables for medium size are defined.

# Test: Search for the variable definitions in the vars.less file. Expect: Definitions for the variables used.
rg --type less -e '--ti-button-group-medium-size' -e '--ti-button-group-medium-line-height' packages/theme/src/button-group/vars.less

Length of output: 216


329-334: Review: New small size styles for button group.

Similar to the medium size, the small size styles are well-defined using CSS variables. This approach maintains a consistent and scalable styling strategy across different button sizes. Again, verify that the variables (--ti-button-group-small-size and --ti-button-group-small-line-height) are properly defined to ensure they are applied correctly.

Verification successful

CSS Variables for Small Size are Defined Correctly

The CSS variables --ti-button-group-small-size and --ti-button-group-small-line-height are properly defined in the vars.less file, ensuring that the small size styles for the button group are applied correctly. No further action is needed.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the CSS variables for small size are defined.

# Test: Search for the variable definitions in the vars.less file. Expect: Definitions for the variables used.
rg --type less --files-with-matches $'--ti-button-group-small-size|--ti-button-group-small-line-height' packages/theme/src/button-group/vars.less

Length of output: 613


Script:

#!/bin/bash
# Description: Verify that the CSS variables for small size are defined.

# Test: Search for the variable definitions in the vars.less file. Expect: Definitions for the variables used.
rg --type less '--ti-button-group-small-size|--ti-button-group-small-line-height' packages/theme/src/button-group/vars.less

Length of output: 592


Script:

#!/bin/bash
# Description: Verify that the CSS variables for small size are defined.

# Test: Search for the variable definitions in the vars.less file. Expect: Definitions for the variables used.
rg --type less -e '--ti-button-group-small-size' -e '--ti-button-group-small-line-height' packages/theme/src/button-group/vars.less

Length of output: 212


335-340: Review: New mini size styles for button group.

The mini size styles are added consistently with the other size variants. Using CSS variables (--ti-button-group-mini-size and --ti-button-group-mini-line-height) enhances the flexibility and maintainability of the styles. As with the other sizes, ensure these variables are defined to prevent any issues during style application.

Verification successful

CSS Variables for Mini Size are Defined

The CSS variables --ti-button-group-mini-size and --ti-button-group-mini-line-height are correctly defined in the vars.less file, ensuring proper support for the mini size styles in the button group.

  • --ti-button-group-mini-size: 24px;
  • --ti-button-group-mini-line-height: 22px;
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that the CSS variables for mini size are defined.

# Test: Search for the variable definitions in the vars.less file. Expect: Definitions for the variables used.
rg --type less --files-with-matches $'--ti-button-group-mini-size|--ti-button-group-mini-line-height' packages/theme/src/button-group/vars.less

Length of output: 609


Script:

#!/bin/bash
# Description: Verify that the CSS variables for mini size are defined.

# Corrected Test: Search for the variable definitions in the vars.less file.
rg '--ti-button-group-mini-size|--ti-button-group-mini-line-height' packages/theme/src/button-group/vars.less

Length of output: 576


Script:

#!/bin/bash
# Description: Verify that the CSS variables for mini size are defined.

# Corrected Test: Use -e option to specify multiple patterns for rg.
rg -e '--ti-button-group-mini-size' -e '--ti-button-group-mini-line-height' packages/theme/src/button-group/vars.less

Length of output: 196

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between fff1aa5 and 25bb6ee.

Files selected for processing (1)
  • examples/sites/demos/pc/app/button-group/sup-composition-api.vue (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • examples/sites/demos/pc/app/button-group/sup-composition-api.vue

@zzcr zzcr merged commit 03cdca0 into opentiny:dev Sep 9, 2024
5 of 6 checks passed
@Youyou-smiles Youyou-smiles deleted the lty/feat-button-group branch September 11, 2024 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants