using Microsoft.AspNetCore.Components; namespace MP.MONO.UI.Components { public partial class ProgBar { #region Public Properties [Parameter] public double currVal { get; set; } = 50; [Parameter] public double maxVal { get; set; } = 100; [Parameter] public int redLim { get; set; } = 10; [Parameter] public int yelLim { get; set; } = 20; [Parameter] public bool singleLine { get; set; } = false; #endregion Public Properties #region Private Properties private string bgStyle { get => $"bg-{currStyle}"; } private string currStyle { get { string answ = "dark"; if (currVal <= redLim) { answ = "danger"; } else if (currVal <= yelLim) { answ = "warning"; } else { answ = "success"; } return answ; } } private int percWidthNum { get => (int)(100 * currVal / maxVal); } private int percWidh { get { int answ = percWidthNum; if (answ <= 0) { answ = 100; } //else if (answ <= redLim) //{ // answ = redLim; //} return answ; } } private string textStyle { get => $"text-{currStyle}"; } private string warnClass { get => currVal > 0 ? "d-none" : "text-danger"; } #endregion Private Properties } }