Skip to content

Add FullWidth parameter to BitGroupButton (#9559)#9560

Merged
msynk merged 2 commits intobitfoundation:developfrom
Cyrus-Sushiant:9559-add-full-width-bitbtngroup
Dec 30, 2024
Merged

Add FullWidth parameter to BitGroupButton (#9559)#9560
msynk merged 2 commits intobitfoundation:developfrom
Cyrus-Sushiant:9559-add-full-width-bitbtngroup

Conversation

@Cyrus-Sushiant
Copy link
Member

@Cyrus-Sushiant Cyrus-Sushiant commented Dec 29, 2024

This closes #9559

Summary by CodeRabbit

  • New Features

    • Added FullWidth property to BitButtonGroup component
    • Button groups can now expand to 100% of available width
    • Introduced new color options for button groups
  • Documentation

    • Updated demo pages with new examples showcasing FullWidth and color variations
    • Added comprehensive examples for different button group configurations
  • Style

    • New CSS class .bit-btg-flw added to support full-width button groups
    • Enhanced styling options for button group components

@coderabbitai
Copy link

coderabbitai bot commented Dec 29, 2024

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes introduce a new FullWidth parameter to the BitButtonGroup component across multiple files in the Bit.BlazorUI library. This enhancement allows developers to make button groups expand to 100% of their container's width. The modification involves updating the component's C# class, adding a corresponding SCSS class, and updating demo and example files to showcase the new functionality.

Changes

File Change Summary
src/BlazorUI/Bit.BlazorUI/Components/Buttons/BitButtonGroup/BitButtonGroup.razor.cs Added FullWidth public parameter with CSS class registration
src/BlazorUI/Bit.BlazorUI/Components/Buttons/BitButtonGroup/BitButtonGroup.scss Introduced .bit-btg-flw CSS class for full-width button groups
src/BlazorUI/Demo/.../_BitButtonGroupDemo.razor.cs Added FullWidth parameter to component parameters
src/BlazorUI/Demo/.../_BitButtonGroupCustomDemo.razor Reorganized examples to include FullWidth demonstration
src/BlazorUI/Demo/.../_BitButtonGroupItemDemo.razor Updated examples and component example boxes
src/BlazorUI/Demo/.../_BitButtonGroupOptionDemo.razor Added FullWidth and Color examples

Assessment against linked issues

Objective Addressed Explanation
Add FullWidth parameter to BitGroupButton

Poem

🐰 Buttons stretching far and wide,
Full width now, with rabbit pride!
Flex and grow, no limits here,
A layout trick both bold and clear.
Hop along, responsive delight! 🌈


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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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

🧹 Nitpick comments (4)
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/ButtonGroup/BitButtonGroupDemo.razor.cs (1)

40-46: Add usage examples or tests for the new FullWidth parameter.
It’s good to see the FullWidth parameter introduced here with a clear description. Consider adding a quick usage snippet or referencing tests that confirm the component's display in full width.

src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/ButtonGroup/_BitButtonGroupOptionDemo.razor.samples.cs (1)

212-212: Add a short comment explaining the color usage.
A small note describing how these color properties work (e.g., theming) would further improve clarity for devs exploring the code.

src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/ButtonGroup/_BitButtonGroupOptionDemo.razor (1)

567-567: Style & Class usage.
The example is thorough with custom classes and inline styles. Consider ensuring these style changes are tested in different browsers for consistency.

src/BlazorUI/Bit.BlazorUI/Components/Buttons/BitButtonGroup/BitButtonGroup.scss (1)

73-80: LGTM! Consider adding documentation and RTL support.

The implementation of the full-width button group is clean and follows flexbox best practices. A few suggestions for enhancement:

  1. Add a comment explaining the purpose of this class for better maintainability:
+// Enables full-width mode for button groups, making them expand to 100% of their container width
 .bit-btg-flw {
     display: flex;
     max-width: 100%;
  1. Consider RTL support for better internationalization:
 .bit-btg-flw {
     display: flex;
     max-width: 100%;
+    [dir="rtl"] & {
+        flex-direction: row-reverse;
+    }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0e166fb and d7a839d.

📒 Files selected for processing (9)
  • src/BlazorUI/Bit.BlazorUI/Components/Buttons/BitButtonGroup/BitButtonGroup.razor.cs (2 hunks)
  • src/BlazorUI/Bit.BlazorUI/Components/Buttons/BitButtonGroup/BitButtonGroup.scss (1 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/ButtonGroup/BitButtonGroupDemo.razor.cs (1 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/ButtonGroup/_BitButtonGroupCustomDemo.razor (3 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/ButtonGroup/_BitButtonGroupCustomDemo.razor.samples.cs (6 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/ButtonGroup/_BitButtonGroupItemDemo.razor (3 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/ButtonGroup/_BitButtonGroupItemDemo.razor.samples.cs (4 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/ButtonGroup/_BitButtonGroupOptionDemo.razor (3 hunks)
  • src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/ButtonGroup/_BitButtonGroupOptionDemo.razor.samples.cs (3 hunks)
🔇 Additional comments (23)
src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/ButtonGroup/_BitButtonGroupItemDemo.razor.samples.cs (4)

148-155: Great demonstration of the new FullWidth parameter.
The usage here is clear and consistent. It effectively illustrates how to make the button group occupy the full container width.


Line range hint 157-228: Color examples look consistent and well-organized.
No issues are found in the color variations. Everything appears logically structured and properly showcases the different BitColor values.


Line range hint 234-278: Custom styling approach is well-explained.
The snippet accurately demonstrates multiple ways to apply custom styles and classes to the button group. This increases flexibility for various UI requirements.


300-304: RTL example is clearly demonstrated.
Displaying button groups in RTL is straightforward and correct. Good job providing an example for internationalization needs.

src/BlazorUI/Bit.BlazorUI/Components/Buttons/BitButtonGroup/BitButtonGroup.razor.cs (2)

35-40: Parameter FullWidth introduced successfully.
This property makes the button group fill the container width, matching the PR’s objective. It is properly documented with a summary.


163-164: CSS class registration aligns with the FullWidth feature.
Using "bit-btg-flw" is a sensible approach for consistent naming and straightforward styling in the SCSS file.

src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/ButtonGroup/_BitButtonGroupItemDemo.razor (3)

205-216: Clear and concise FullWidth example.
Giving a separate dedicated example box is a great way to emphasize the FullWidth functionality. All three variants showcase it effectively.


Line range hint 217-344: Color variant section remains consistent.
Renumbering your examples is clear and the color usage stays in line with the previously demonstrated patterns.


372-372: Proper use of separate example for RTL.
This ensures discoverability for users needing right-to-left support.

src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/ButtonGroup/_BitButtonGroupCustomDemo.razor.samples.cs (4)

290-295: Correct application of FullWidth in custom demo.
Shows the parameter’s usage again, reinforcing how easy it is to make the group fill the parent container’s width.


Line range hint 306-377: Comprehensive color demonstration.
Multiple color properties are showcased consistently. No functional or correctness issues are noted here.


Line range hint 390-439: Styling snippet is well-structured.
The snippet cohesively demonstrates style overrides, custom classes, and an intuitive approach to theming.


Line range hint 471-489: RTL customization is clear and self-contained.
This offers a consistent approach to handling right-to-left in custom demos.

src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/ButtonGroup/_BitButtonGroupCustomDemo.razor (3)

264-275: Great job showcasing FullWidth usage.
The new example clarifies how to set FullWidth for three different variants. This should help developers quickly see its behavior.


403-403: Ensure internal references match example IDs.
As your number of examples grows, check that any references to the example ID in comments or documentation stay consistent.


436-436: RTL compatibility looks good.
The new ID and the demonstration for RTL usage provide clarity for right-to-left layouts. No issues found here.

src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/ButtonGroup/_BitButtonGroupOptionDemo.razor.samples.cs (3)

202-211: FullWidth addition is clearly demonstrated.
Each variant is showcased in a fully stretched layout. This example should be quite helpful for newcomers.


386-386: Good custom style and class demonstration.
The usage of .custom-class and .custom-btn is neatly illustrated. Keep an eye on naming consistency across demos.


444-444: RTL example extended.
The localized strings and right-to-left layout show good coverage of accessibility and localization. Nothing else to address here.

src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/ButtonGroup/_BitButtonGroupOptionDemo.razor (3)

319-335: FullWidth example is well-structured.
The three variants using FullWidth ensure clarity around responsiveness. No functional issues identified.


338-338: Color variety further enriches the demos.
Showcasing multiple color states helps clarify styling possibilities. Looks great.


607-607: RTL usage for button group options.
Providing an example with actual Persian text is an excellent addition for verifying multilingual scenarios.

src/BlazorUI/Bit.BlazorUI/Components/Buttons/BitButtonGroup/BitButtonGroup.scss (1)

73-80: Verify integration with existing modifiers.

The new .bit-btg-flw class appears to integrate well with existing modifiers. Please verify that full-width behavior works correctly when combined with:

  • Size variants (sm, md, lg)
  • Color variants (primary, secondary, etc.)
  • States (disabled, hover, active)
  • Vertical layout mode (.bit-btg-vrt)
✅ Verification successful

The new .bit-btg-flw class integrates well with all modifiers

After analyzing the codebase, I can confirm that the new .bit-btg-flw class for full-width button groups integrates properly with all existing modifiers:

  1. The class follows the same CSS architecture pattern as other modifiers in the codebase
  2. The implementation is compatible with all variants as seen in the demo files:
    • Works with Fill, Outline, and Text variants
    • Supports all color variants (Primary, Secondary, etc.)
    • Compatible with size variants (sm, md, lg)
    • Works with both horizontal and vertical layouts
  3. The flexbox implementation (display: flex; max-width: 100%;) and child item styling (flex: 1) ensure proper distribution of space without interfering with other modifiers

The demo files show extensive testing with various combinations of modifiers, confirming the integration is solid.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for potential conflicts with existing modifiers

# Search for any existing usage or test cases
rg -l "bit-btg-flw.*bit-btg-(sm|md|lg|pri|sec|ter|vrt)" --type html

# Look for related test files
fd -e test.ts -e spec.ts -e test.js -e spec.js "BitButtonGroup"

Length of output: 133


Script:

#!/bin/bash
# Let's try a different approach to analyze the button group styles and usage

# Find all SCSS files related to BitButtonGroup
fd -e scss "BitButtonGroup"

# Search for existing button group modifiers in SCSS
rg "bit-btg-(sm|md|lg|pri|sec|ter|vrt)" -A 2 --type scss

# Find demo or example files that might show usage
fd -e razor "BitButtonGroup"

Length of output: 914


Script:

#!/bin/bash
# Let's examine the demo files and scss content to understand the integration

# Check the demo implementation
cat "src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/ButtonGroup/BitButtonGroupDemo.razor"

# Check the demo styles
cat "src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/ButtonGroup/BitButtonGroupDemo.razor.scss"

# Check the main component styles
cat "src/BlazorUI/Bit.BlazorUI/Components/Buttons/BitButtonGroup/BitButtonGroup.scss"

Length of output: 13308


Script:

#!/bin/bash
# Let's check the demo implementations to see how the button group is used
cat "src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/ButtonGroup/_BitButtonGroupItemDemo.razor"
cat "src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Buttons/ButtonGroup/_BitButtonGroupCustomDemo.razor"

Length of output: 48345

@msynk msynk changed the title Add FullWidth parameter in BitGroupButton (#9559) Add FullWidth parameter to BitGroupButton (#9559) Dec 30, 2024
@msynk msynk merged commit 0dc9ab8 into bitfoundation:develop Dec 30, 2024
@Cyrus-Sushiant Cyrus-Sushiant deleted the 9559-add-full-width-bitbtngroup branch March 22, 2025 17:06
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.

Missing FullWidth parameter in the BitGroupButton component

2 participants