21 lines
766 B
Plaintext
21 lines
766 B
Plaintext
@namespace Shared.Components
|
|
|
|
<div class="mana-curve">
|
|
@foreach (var entry in Distribution)
|
|
{
|
|
var height = MaxCount > 0 ? entry.Count * 100 / MaxCount : 0;
|
|
<div class="mana-bar-container">
|
|
<div class="mana-bar-label">@entry.Count</div>
|
|
<div class="mana-bar" style="height: @($"{Math.Max(height, 5)}%")"></div>
|
|
<div class="mana-cost">@(entry.Cost >= MaxCostLabel ? $"{MaxCostLabel}+" : entry.Cost.ToString())</div>
|
|
</div>
|
|
}
|
|
</div>
|
|
|
|
@code {
|
|
[Parameter][EditorRequired] public List<(int Cost, int Count)> Distribution { get; set; } = [];
|
|
[Parameter] public int MaxCostLabel { get; set; } = 10;
|
|
|
|
private int MaxCount => Distribution.Count > 0 ? Distribution.Max(x => x.Count) : 0;
|
|
}
|