using Connected.Annotations;
using Connected.Utilities;
using Microsoft.AspNetCore.Components;
namespace Connected.Components;
public partial class Breadcrumbs : UIComponent
{
///
/// A list of breadcrumb items/links.
///
[Parameter]
[Category(CategoryTypes.Breadcrumbs.Behavior)]
public List Items { get; set; }
///
/// Specifies the separator between the items.
///
[Parameter]
[Category(CategoryTypes.Breadcrumbs.Appearance)]
public string Separator { get; set; } = "/";
///
/// Specifies a RenderFragment to use as the separator.
///
[Parameter]
[Category(CategoryTypes.Breadcrumbs.Appearance)]
public RenderFragment SeparatorTemplate { get; set; }
///
/// Specifies a RenderFragment to use as the items' contents.
///
[Parameter]
[Category(CategoryTypes.Breadcrumbs.Behavior)]
public RenderFragment ItemTemplate { get; set; }
///
/// Controls when (and if) the breadcrumbs will automatically collapse.
///
[Parameter]
[Category(CategoryTypes.Breadcrumbs.Behavior)]
public byte? MaxItems { get; set; }
///
/// Custom expander icon.
///
[Parameter]
[Category(CategoryTypes.Breadcrumbs.Appearance)]
public string ExpanderIcon { get; set; } = Icons.Material.Filled.SettingsEthernet;
public bool Collapsed { get; private set; } = true;
private string Classname => new CssBuilder("mud-breadcrumbs")
.AddClass("mud-typography-body1")
.AddClass(Class)
.Build();
internal static string GetItemClassname(BreadcrumbItem item)
{
return new CssBuilder("mud-breadcrumb-item")
.AddClass("mud-disabled", item.Disabled)
.Build();
}
internal void Expand()
{
if (!Collapsed)
return;
Collapsed = false;
StateHasChanged();
}
}