Add new Icon parameters to BitDialog (#12242)#12243
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughThe Changes
Poem
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Adds support for customizing the BitDialog close-button icon via the new CloseIcon (BitIconInfo?) and CloseIconName (string?) parameters, updating the demo and tests accordingly.
Changes:
- Add
CloseIcon/CloseIconNameparameters toBitDialogand render the resolved icon viaBitIconInfo.From(...). - Add bUnit tests covering default icon, icon name, external icon CSS helpers, and precedence.
- Extend the dialog demo with an “External Icons” example and
BitIconInfoparameter docs.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Dialog/BitDialog.razor.cs | Adds new public parameters for close icon customization. |
| src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Dialog/BitDialog.razor | Renders the close icon using BitIconInfo and updates button/icon markup. |
| src/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Surfaces/Dialog/BitDialogTests.cs | Adds unit tests for default/custom/external close icon behavior and precedence. |
| src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/Dialog/BitDialogDemo.razor.cs | Adds demo parameter docs and code snippets for external icon usage. |
| src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/Dialog/BitDialogDemo.razor | Adds “External Icons” demo section showcasing new parameters. |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Dialog/BitDialog.razor`:
- Around line 36-41: The close button in BitDialog.razor is currently marked
aria-hidden="true", which hides an interactive control from assistive tech;
remove the aria-hidden attribute from the <button> that uses HandleOnCloseClick
and class "bit-dlg-cls" while keeping the aria-label="Close" and other
attributes intact so the control remains accessible to screen readers.
In
`@src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/Dialog/BitDialogDemo.razor`:
- Line 215: The DemoExample instance for "External Icons" is missing its
CsharpCode binding so the state snippet (example9CsharpCode) isn't displayed;
update the DemoExample markup (the element with Title="External Icons" and
Id="example9") to include CsharpCode="@example9CsharpCode" alongside
RazorCode="@example9RazorCode" so the C# snippet defined in the code-behind is
shown.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: b01989c5-b3b1-4856-81a8-62b61796f3a1
📒 Files selected for processing (5)
src/BlazorUI/Bit.BlazorUI/Components/Surfaces/Dialog/BitDialog.razorsrc/BlazorUI/Bit.BlazorUI/Components/Surfaces/Dialog/BitDialog.razor.cssrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/Dialog/BitDialogDemo.razorsrc/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Surfaces/Dialog/BitDialogDemo.razor.cssrc/BlazorUI/Tests/Bit.BlazorUI.Tests/Components/Surfaces/Dialog/BitDialogTests.cs
closes #12242
Summary by CodeRabbit
New Features
CloseIconandCloseIconNameparameters, with support for FontAwesome, Bootstrap Icons, and other custom icon libraries.Tests