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/AppBar/AppBar.razor.cs

76 lines
1.8 KiB

2 years ago
using Connected.Extensions;
using Connected.Utilities;
using Microsoft.AspNetCore.Components;
namespace Connected.Components;
public partial class AppBar : UIComponent
{
/// <summary>
/// If true, Appbar will be placed at the bottom of the screen.
/// </summary>
[Parameter]
public bool Bottom { get; set; }
/// <summary>
/// The higher the number, the heavier the drop-shadow. 0 for no shadow.
/// </summary>
[Parameter]
public int Elevation { set; get; } = 4;
/// <summary>
/// If true, compact padding will be used.
/// </summary>
[Parameter]
public bool Dense { get; set; }
/// <summary>
/// If true, the left and right padding is removed from from the appbar.
/// </summary>
[Parameter]
public bool DisableGutters { get; set; }
/// <summary>
/// The color of the component. It supports the theme colors.
/// </summary>
[Parameter]
public ThemeColor Color { get; set; } = ThemeColor.Default;
/// <summary>
/// If true, appbar will be Fixed.
/// </summary>
[Parameter]
public bool Fixed { get; set; } = true;
/// <summary>
/// User class names, separated by spaces for the nested toolbar.
/// </summary>
[Parameter]
public string? ToolBarClass { get; set; }
/// <summary>
/// Child content of the component.
/// </summary>
[Parameter]
public RenderFragment? ChildContent { get; set; }
protected string ClassList()
{
return new CssBuilder("appbar")
.AddClass($"appbar-dense", Dense)
.AddClass($"appbar-fixed-top", Fixed && !Bottom)
.AddClass($"appbar-fixed-bottom", Fixed && Bottom)
.AddClass($"elevation-{Elevation}")
.AddClass($"theme-{Color.ToDescriptionString()}", Color != ThemeColor.Default)
.AddClass(Class)
.Build();
}
protected string ToolBarClassList()
{
return new CssBuilder("toolbar-appbar")
.AddClass(ToolBarClass)
.Build();
}
}