47 lines
1.5 KiB
Plaintext
47 lines
1.5 KiB
Plaintext
@inherits DComponentBase
|
|||
|
|
|
||
|
|
@* daisyUI Loading: https://daisyui.com/components/loading/ . It is drawn in currentColor, so Color maps to text-*
|
||
|
|
classes. role="status" and aria-label come before the splatted attributes, so a consumer can override them. *@
|
||
|
|
<span role="status" aria-label="@LabelText" @attributes="AdditionalAttributes" class="@CssClass"></span>
|
||
|
|
|
||
|
|
@code {
|
||
|
|
[Parameter] public DLoadingVariant Variant { get; set; }
|
||
|
|
[Parameter] public DSize Size { get; set; }
|
||
|
|
[Parameter] public DColor Color { get; set; }
|
||
|
|
/// <summary>What screen readers announce (aria-label).</summary>
|
||
|
|
[Parameter] public string LabelText { get; set; } = "Loading";
|
||
|
|
|
||
|
|
string CssClass => Cx("loading", VariantClass, SizeClass, ColorClass, Class);
|
||
|
|
|
||
|
|
string VariantClass => Variant switch
|
||
|
|
{
|
||
|
|
DLoadingVariant.Dots => "loading-dots",
|
||
|
|
DLoadingVariant.Ring => "loading-ring",
|
||
|
|
DLoadingVariant.Ball => "loading-ball",
|
||
|
|
DLoadingVariant.Bars => "loading-bars",
|
||
|
|
DLoadingVariant.Infinity => "loading-infinity",
|
||
|
|
_ => null
|
||
|
|
};
|
||
|
|
|
||
|
|
string SizeClass => Size switch
|
||
|
|
{
|
||
|
|
DSize.Xs => "loading-xs",
|
||
|
|
DSize.Sm => "loading-sm",
|
||
|
|
DSize.Lg => "loading-lg",
|
||
|
|
DSize.Xl => "loading-xl",
|
||
|
|
_ => null
|
||
|
|
};
|
||
|
|
|
||
|
|
string ColorClass => Color switch
|
||
|
|
{
|
||
|
|
DColor.Neutral => "text-neutral",
|
||
|
|
DColor.Primary => "text-primary",
|
||
|
|
DColor.Secondary => "text-secondary",
|
||
|
|
DColor.Accent => "text-accent",
|
||
|
|
DColor.Info => "text-info",
|
||
|
|
DColor.Success => "text-success",
|
||
|
|
DColor.Warning => "text-warning",
|
||
|
|
DColor.Error => "text-error",
|
||
|
|
_ => null
|
||
|
|
};
|
||
|
|
}
|