-
-
Notifications
You must be signed in to change notification settings - Fork 363
feat(BreadcrumbItem): add CssClass property #6673
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
Reviewer's GuideThis PR enhances the Breadcrumb component by adding a CssClass property to BreadcrumbItem, updating rendering logic to include custom classes and handle null values, and adjusts related markup and tests accordingly. Class diagram for updated BreadcrumbItem with CssClass propertyclassDiagram
class BreadcrumbItem {
+string Text
+string? Url
+string? CssClass
+BreadcrumbItem(string text, string? url = null, string? cssClass = null)
}
Class diagram for updated Breadcrumb component rendering logicclassDiagram
class Breadcrumb {
+IEnumerable<BreadcrumbItem>? Value
+protected override void OnParametersSet()
+static string? GetItemClassString(BreadcrumbItem item)
}
Breadcrumb --> "*" BreadcrumbItem
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.
Pull Request Overview
This PR adds a CssClass property to the BreadcrumbItem class to allow custom CSS styling of individual breadcrumb items. The changes modernize the class using C# primary constructor syntax and update the rendering logic to apply the custom CSS classes.
- Converts BreadcrumbItem to use C# primary constructor with CssClass parameter
- Updates breadcrumb rendering to include custom CSS classes in the output
- Adds tests to verify the CssClass functionality works correctly
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| BreadcrumbItem.cs | Converts to primary constructor and adds CssClass property |
| Breadcrumb.razor.cs | Updates rendering method and adds null initialization for Value property |
| Breadcrumb.razor | Updates template to use new CSS class method and fixes CascadingValue placement |
| BreadcrumbsTest.cs | Adds test cases for the new CssClass functionality |
| Button.razor.cs | Updates documentation comment to use inheritdoc |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
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 there - 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/Components/Breadcrumb/Breadcrumb.razor.cs:17` </location>
<code_context>
/// </summary>
[Parameter]
- public IEnumerable<BreadcrumbItem> Value { get; set; } = Enumerable.Empty<BreadcrumbItem>();
+ [NotNull]
+ public IEnumerable<BreadcrumbItem>? Value { get; set; }
- private string? GetItemClassName(BreadcrumbItem item) => CssBuilder.Default("breadcrumb-item")
</code_context>
<issue_to_address>
The [NotNull] annotation may be redundant due to null-coalescing in OnParametersSet.
Consider removing the [NotNull] attribute, as Value is always assigned a non-null value in OnParametersSet.
</issue_to_address>
<suggested_fix>
<<<<<<< SEARCH
[Parameter]
[NotNull]
public IEnumerable<BreadcrumbItem>? Value { get; set; }
=======
[Parameter]
public IEnumerable<BreadcrumbItem>? Value { get; set; }
>>>>>>> REPLACE
</suggested_fix>
### Comment 2
<location> `test/UnitTest/Components/BreadcrumbsTest.cs:39` </location>
<code_context>
{
pb.Add(b => b.AdditionalAttributes, new Dictionary<string, object>() { ["tag"] = "tagok" });
});
+ cut.Contains("tag=\"tagok\"");
+
+ cut.SetParametersAndRender(pb =>
</code_context>
<issue_to_address>
Typo in assertion: should use Assert.Contains instead of cut.Contains.
Replace 'cut.Contains("tag=\"tagok\"")' with 'Assert.Contains("tag=\"tagok\"", cut.Markup)' to properly verify the output in the test.
</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 #6673 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 739 739
Lines 31707 31698 -9
Branches 4460 4462 +2
=========================================
- Hits 31707 31698 -9
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 #6672
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Add CssClass support for breadcrumb items and prevent rendering when Value is null
New Features:
Bug Fixes:
Enhancements:
Tests: