-
-
Notifications
You must be signed in to change notification settings - Fork 362
feat(Toolbar): add Toolbar component #6547
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
Conversation
# Conflicts: # test/UnitTest/Components/ButtonTest.cs
Reviewer's GuideImplements a new Toolbar UI component (with subcomponents, styling and samples), enhances CheckboxList/RadioList to support custom item templates and optional border coloring with updated styles for seamless button groups, and adds a test assertion to validate two-way binding. Class diagram for enhanced CheckboxList and RadioList componentsclassDiagram
class CheckboxList {
+bool IsButton
+bool ShowButtonBorderColor
+string? CheckboxItemClass
+bool ShowBorder
-string? GetButtonItemClassString(SelectedItem item)
}
class RadioList {
+bool ShowButtonBorderColor
-string? GetButtonItemClassString(SelectedItem item)
}
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ArgoZhang - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `src/BootstrapBlazor.Server/Components/Samples/Toolbars.razor.cs:13` </location>
<code_context>
+/// </summary>
+public partial class Toolbars
+{
+ private readonly List<SelectedItem> _items1 = [];
+ private string _item1 = "1,2";
+
</code_context>
<issue_to_address>
Consider extracting repeated item list creation into a helper method and replacing switch expressions with dictionaries to centralize data and icon mappings.
```csharp
// 1. Extract the repeated item list into a helper
private static List<SelectedItem> CreateDefaultItems() => new()
{
new("1", "Text1"),
new("2", "Text2"),
new("3", "Text3")
};
private readonly List<SelectedItem> _items1 = CreateDefaultItems();
private readonly List<SelectedItem> _items2 = CreateDefaultItems();
private readonly List<SelectedItem> _items3 = CreateDefaultItems();
// 2. Replace switch‐expressions with dictionaries
private static readonly Dictionary<string, string> _alignIcons = new()
{
["1"] = "fa-solid fa-align-left",
["2"] = "fa-solid fa-align-center",
["3"] = "fa-solid fa-align-right"
};
private static readonly Dictionary<string, string> _formatIcons = new()
{
["1"] = "fa-solid fa-bold",
["2"] = "fa-solid fa-italic",
["3"] = "fa-solid fa-font"
};
private static string GetIconByItem(string v) => _alignIcons[v];
private static string GetRadioIconByItem(string v) => _formatIcons[v];
```
- OnInitialized can now be removed since lists are built at declaration.
- This keeps behavior identical while centralizing both the data and icon mappings.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6547 +/- ##
===========================================
+ Coverage 99.93% 100.00% +0.06%
===========================================
Files 715 721 +6
Lines 31471 31519 +48
Branches 4444 4449 +5
===========================================
+ Hits 31451 31519 +68
+ Misses 15 0 -15
+ Partials 5 0 -5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Link issues
fixes #6546
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Implement a new Toolbar component suite and enhance button lists by adding item templates, border color control, and refined styling
New Features:
Enhancements:
Documentation:
Tests: