Files
Heimdall/src/Heimdall.Web/Components/Shared/LoadingSkeleton.razor
T

43 lines
1.2 KiB
Plaintext
Raw Normal View History

@* Skeleton loading placeholder for cards and content areas. *@
<MudPaper Elevation="0" Class="@($"pa-4 {Class}")" Style="border-radius: 12px; border: 1px solid var(--mud-palette-lines-default);">
@if (ShowTitle)
{
<MudSkeleton Width="180px" Height="22px" Style="border-radius:6px;" />
}
@for (int i = 0; i < LineCount; i++)
{
<MudSkeleton Width="@GetWidth(i)" Height="42px"
Style="border-radius:8px;"
Class="@(i > 0 || ShowTitle ? "mt-2" : "")" />
}
</MudPaper>
@code {
/// <summary>
/// Number of skeleton content lines to render. Defaults to 4.
/// </summary>
[Parameter]
public int LineCount { get; set; } = 4;
/// <summary>
/// Whether to show a title skeleton row at the top. Defaults to true.
/// </summary>
[Parameter]
public bool ShowTitle { get; set; } = true;
/// <summary>
/// Additional CSS classes applied to the paper.
/// </summary>
[Parameter]
public string Class { get; set; } = string.Empty;
private string GetWidth(int index) => (index % 3) switch
{
0 => "100%",
1 => "85%",
_ => "92%"
};
}