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.
Connected.Components/Components/NavMenu/NavMenu.razor.cs

59 lines
1.7 KiB

2 years ago
using Connected.Annotations;
using Connected.Extensions;
using Connected.Utilities;
using Microsoft.AspNetCore.Components;
namespace Connected.Components;
public partial class NavMenu : UIComponent
{
protected string Classname =>
new CssBuilder("mud-navmenu")
.AddClass($"mud-navmenu-{Color.ToDescriptionString()}")
.AddClass($"mud-navmenu-margin-{Margin.ToDescriptionString()}")
.AddClass("mud-navmenu-dense", Dense)
.AddClass("mud-navmenu-rounded", Rounded)
.AddClass($"mud-navmenu-bordered mud-border-{Color.ToDescriptionString()}", Bordered)
.AddClass(Class)
.Build();
[Category(CategoryTypes.NavMenu.Behavior)]
[Parameter] public RenderFragment ChildContent { get; set; }
/// <summary>
/// The color of the active NavLink.
/// </summary>
[Parameter]
[Category(CategoryTypes.NavMenu.Appearance)]
public ThemeColor Color { get; set; } = ThemeColor.Default;
/// <summary>
/// If true, adds a border of the active NavLink, does nothing if variant outlined is used.
/// </summary>
[Parameter]
[Category(CategoryTypes.NavMenu.Appearance)]
public bool Bordered { get; set; }
/// <summary>
/// If true, default theme border-radius will be used on all navlinks.
/// </summary>
[Parameter]
[Category(CategoryTypes.NavMenu.Appearance)]
public bool Rounded { get; set; }
/// <summary>
/// Adjust the vertical spacing between navlinks.
/// </summary>
[Parameter]
[Category(CategoryTypes.NavMenu.Appearance)]
public Margin Margin { get; set; } = Margin.None;
/// <summary>
/// If true, compact vertical padding will be applied to all navmenu items.
/// </summary>
[Parameter]
[Category(CategoryTypes.NavMenu.Appearance)]
public bool Dense { get; set; }
}