feat(BootstrapInputGroupLabel): add ChildContent parameter#5905
feat(BootstrapInputGroupLabel): add ChildContent parameter#5905
Conversation
Reviewer's Guide by SourceryThis pull request adds a new No diagrams generated as the changes look simple and do not need a visual representation. File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Pull Request Overview
This pull request enhances the BootstrapInputGroupLabel component by supporting a custom ChildContent parameter, allowing developers to render custom content instead of the default DisplayText.
- Updated the component's markup (.razor) for conditional rendering based on ChildContent.
- Added a new RenderFragment? ChildContent parameter in the component code-behind (.razor.cs).
- Enhanced the unit tests to verify that ChildContent renders correctly when provided.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/UnitTest/Components/InputTest.cs | Updated tests to check the rendering of ChildContent versus the fallback DisplayText. |
| src/BootstrapBlazor/Components/Input/BootstrapInputGroupLabel.razor.cs | Introduced the ChildContent parameter with proper XML documentation. |
| src/BootstrapBlazor/Components/Input/BootstrapInputGroupLabel.razor | Updated markup to conditionally render ChildContent or DisplayText for both div and label elements. |
There was a problem hiding this comment.
Hey @ArgoZhang - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider consolidating the conditional rendering logic for
ChildContentvsDisplayTextto avoid duplication between thedivandlabelelements.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Link issues
fixes #5904
Summary By Copilot
This pull request introduces support for custom child content in the
BootstrapInputGroupLabelcomponent, allowing more flexibility in rendering its content. The key changes include updates to the Razor file, the component's parameters, and corresponding unit tests.Component Enhancements:
src/BootstrapBlazor/Components/Input/BootstrapInputGroupLabel.razor: Updated the rendering logic to check forChildContent. IfChildContentis provided, it will be rendered; otherwise, the fallbackDisplayTextis displayed. This applies to both<div>and<label>elements.src/BootstrapBlazor/Components/Input/BootstrapInputGroupLabel.razor.cs: Added a new[Parameter]property,ChildContent, of typeRenderFragment?, enabling users to pass custom content to the component.Testing Enhancements:
test/UnitTest/Components/InputTest.cs: Enhanced theGroupLabel_Oktest to verify the behavior of theChildContentparameter. The test ensures that whenChildContentis set, it is rendered instead ofDisplayText.Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Allow custom content within the
BootstrapInputGroupLabelcomponent.New Features:
ChildContentparameter toBootstrapInputGroupLabelto enable rendering custom content instead of the defaultDisplayText.ChildContentoverDisplayTextwhen provided.Tests:
ChildContentis provided.