using Connected.Annotations;
using Connected.Extensions;
using Connected.Utilities;
using Microsoft.AspNetCore.Components;
namespace Connected.Components;
public partial class Skeleton : UIComponent
{
protected string Classname =>
new CssBuilder("mud-skeleton")
.AddClass($"mud-skeleton-{SkeletonType.ToDescriptionString()}")
.AddClass($"mud-skeleton-{Animation.ToDescriptionString()}")
.AddClass(Class)
.Build();
///
/// With defined in string, needs px or % or equal prefix.
///
[Parameter]
[Category(CategoryTypes.Skeleton.Appearance)]
public string Width { set; get; }
///
/// Height defined in string, needs px or % or equal prefix.
///
[Parameter]
[Category(CategoryTypes.Skeleton.Appearance)]
public string Height { set; get; }
///
/// Shape of the skeleton that will be rendered.
///
[Parameter]
[Category(CategoryTypes.Skeleton.Appearance)]
public SkeletonType SkeletonType { set; get; } = SkeletonType.Text;
///
/// Animation style, if false it will be disabled.
///
[Parameter]
[Category(CategoryTypes.Skeleton.Appearance)]
public Animation Animation { set; get; } = Animation.Pulse;
private string _width;
private string _height;
private string _styleString;
protected override void OnInitialized()
{
if (!string.IsNullOrEmpty(Width))
{
_width = $"width:{Width};";
}
if (!string.IsNullOrEmpty(Height))
{
_height = $"height:{Height};";
}
_styleString = $"{_width}{_height}{Style}";
}
}