30 lines
1.1 KiB
Plaintext
30 lines
1.1 KiB
Plaintext
@using System.Globalization
|
|||
|
|
@inherits DComponentBase
|
||
|
|
|
||
|
|
@* daisyUI Progress: https://daisyui.com/components/progress/ . A null Value leaves out the value attribute, which makes
|
||
|
|
the bar indeterminate (animated). Numbers are written with the invariant culture. The width comes from class
|
||
|
|
(it is 100% by default). *@
|
||
|
|
<progress @attributes="AdditionalAttributes" class="@CssClass" value="@(Value?.ToString(CultureInfo.InvariantCulture))"
|
||
|
|
max="@(Max.ToString(CultureInfo.InvariantCulture))"></progress>
|
||
|
|
|
||
|
|
@code {
|
||
|
|
/// <summary>The progress, from 0 to Max; null shows an indeterminate bar.</summary>
|
||
|
|
[Parameter] public double? Value { get; set; }
|
||
|
|
[Parameter] public double Max { get; set; } = 100;
|
||
|
|
[Parameter] public DColor Color { get; set; }
|
||
|
|
|
||
|
|
string CssClass => Cx("progress", ColorClass, Class);
|
||
|
|
|
||
|
|
string ColorClass => Color switch
|
||
|
|
{
|
||
|
|
DColor.Neutral => "progress-neutral",
|
||
|
|
DColor.Primary => "progress-primary",
|
||
|
|
DColor.Secondary => "progress-secondary",
|
||
|
|
DColor.Accent => "progress-accent",
|
||
|
|
DColor.Info => "progress-info",
|
||
|
|
DColor.Success => "progress-success",
|
||
|
|
DColor.Warning => "progress-warning",
|
||
|
|
DColor.Error => "progress-error",
|
||
|
|
_ => null
|
||
|
|
};
|
||
|
|
}
|