You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
1.8 KiB
73 lines
1.8 KiB
using Connected.Annotations;
|
|
using Connected.Utilities;
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
namespace Connected.Components;
|
|
|
|
public partial class Breadcrumbs : UIComponent
|
|
{
|
|
/// <summary>
|
|
/// A list of breadcrumb items/links.
|
|
/// </summary>
|
|
[Parameter]
|
|
[Category(CategoryTypes.Breadcrumbs.Behavior)]
|
|
public List<BreadcrumbItem> Items { get; set; }
|
|
|
|
/// <summary>
|
|
/// Specifies the separator between the items.
|
|
/// </summary>
|
|
[Parameter]
|
|
[Category(CategoryTypes.Breadcrumbs.Appearance)]
|
|
public string Separator { get; set; } = "/";
|
|
|
|
/// <summary>
|
|
/// Specifies a RenderFragment to use as the separator.
|
|
/// </summary>
|
|
[Parameter]
|
|
[Category(CategoryTypes.Breadcrumbs.Appearance)]
|
|
public RenderFragment SeparatorTemplate { get; set; }
|
|
|
|
/// <summary>
|
|
/// Specifies a RenderFragment to use as the items' contents.
|
|
/// </summary>
|
|
[Parameter]
|
|
[Category(CategoryTypes.Breadcrumbs.Behavior)]
|
|
public RenderFragment<BreadcrumbItem> ItemTemplate { get; set; }
|
|
|
|
/// <summary>
|
|
/// Controls when (and if) the breadcrumbs will automatically collapse.
|
|
/// </summary>
|
|
[Parameter]
|
|
[Category(CategoryTypes.Breadcrumbs.Behavior)]
|
|
public byte? MaxItems { get; set; }
|
|
|
|
/// <summary>
|
|
/// Custom expander icon.
|
|
/// </summary>
|
|
[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();
|
|
}
|
|
}
|