Skip to content

Commit 67a1c3a

Browse files
committed
feat: support badge color for tabs
1 parent 2f92cc0 commit 67a1c3a

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

src/Tabs/Abstractions/IBafTab.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
namespace Avolutions.Baf.Blazor.Tabs.Abstractions;
1+
using MudBlazor;
2+
3+
namespace Avolutions.Baf.Blazor.Tabs.Abstractions;
24

35
public interface IBafTab
46
{
57
string Title { get; }
68
object? BadgeData { get; }
9+
Color BadgeColor { get; }
710
Task OnActivatedAsync();
811
Task OnAddedAsync();
912
}

src/Tabs/Components/BafTabs.razor

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
Border="true">
1313
@foreach (var tab in _tabs)
1414
{
15-
<MudTabPanel Text="@tab.Title" BadgeData="@tab.BadgeData">
15+
<MudTabPanel Text="@tab.Title" BadgeData="@tab.BadgeData" BadgeColor="@tab.BadgeColor">
1616
@tab.Content
1717
</MudTabPanel>
1818
}
@@ -29,6 +29,7 @@
2929
{
3030
public string Title { get; set; } = string.Empty;
3131
public object? BadgeData { get; set; }
32+
public Color BadgeColor { get; set; } = Color.Primary;
3233
public RenderFragment Content { get; set; } = null!;
3334
public IBafTab TabInstance { get; set; } = null!;
3435
}
@@ -46,6 +47,7 @@
4647
{
4748
Title = title,
4849
BadgeData = tabInstance.BadgeData,
50+
BadgeColor = tabInstance.BadgeColor,
4951
Content = content,
5052
TabInstance = tabInstance
5153
});

src/Tabs/Models/BafTab.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using Avolutions.Baf.Blazor.Tabs.Abstractions;
22
using Avolutions.Baf.Blazor.Tabs.Components;
33
using Microsoft.AspNetCore.Components;
4+
using MudBlazor;
45

56
namespace Avolutions.Baf.Blazor.Tabs.Models;
67

@@ -12,6 +13,7 @@ public abstract class BafTab : ComponentBase, IBafTab
1213
public abstract string Title { get; }
1314

1415
public virtual object? BadgeData => null;
16+
public virtual Color BadgeColor => Color.Primary;
1517

1618
protected override async Task OnInitializedAsync()
1719
{

0 commit comments

Comments
 (0)