Files
mapo-mono/MP.MONO.UI/Components/ProgBar.razor
T

46 lines
908 B
Plaintext

<div class="text-center">
<b>@currVal.ToString("N0")</b>
</div>
<div class="progress">
<div class="progress-bar @bgStyle" style="width:@(percWidth)%">@(percWidth)%</div>
</div>
@code {
protected string bgStyle
{
get
{
string answ = "bg-dark";
if (currVal <= redLim)
{
answ = "bg-danger";
}
else if (currVal <= yelLim)
{
answ = "bg-warning";
}
else
{
answ = "bg-success";
}
return answ;
}
}
[Parameter]
public double currVal { get; set; } = 50;
[Parameter]
public double maxVal { get; set; } = 100;
private int percWidth
{
get => (int)(100 * currVal / maxVal);
}
protected int redLim = 24 * 3;
protected int yelLim = 24 * 5;
}