Added CategoryBadgeComponent
This commit is contained in:
parent
78f1d291f3
commit
d0ad6d8cb5
|
@ -31,9 +31,7 @@
|
|||
@if (Article.Categories.Count > 0) {
|
||||
<p class="flex flex-wrap gap-2 my-3">
|
||||
@foreach (var category in Article.Categories.OrderBy(c => c.Color)) {
|
||||
<span class="badge badge-@CategoryUtilities.GetCssClassPostfixForColor(category.Color)">
|
||||
@category.Name
|
||||
</span>
|
||||
<CategoryBadgeComponent Category="category" />
|
||||
}
|
||||
</p>
|
||||
}
|
||||
|
|
14
Wave/Components/CategoryBadgeComponent.razor
Normal file
14
Wave/Components/CategoryBadgeComponent.razor
Normal file
|
@ -0,0 +1,14 @@
|
|||
@using Wave.Utilities
|
||||
@using Wave.Data
|
||||
|
||||
<span class="badge badge-@CategoryUtilities.GetCssClassPostfixForColor(Category.Color)" @attributes="AdditionalAttributes">
|
||||
@Category.Name
|
||||
</span>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public required Category Category { get; set; }
|
||||
[Parameter(CaptureUnmatchedValues = true)]
|
||||
public Dictionary<string, object>? AdditionalAttributes { get; set; }
|
||||
|
||||
}
|
Loading…
Reference in a new issue