@inherits LocalizableComponentBase
@* Nerd stats on hover or focus: a DTooltip whose content is a monospace list of label/value rows. OnOpen runs on the
first hover or focus, for stats read on demand (a post's provenance); rows with no value are left out. *@
@ChildContent
@code {
[Parameter] public RenderFragment ChildContent { get; set; }
[Parameter] public string Heading { get; set; }
[Parameter] public IEnumerable Rows { get; set; } = [];
/// Shown under the rows while OnOpen's work runs.
[Parameter] public bool Pending { get; set; }
[Parameter] public EventCallback OnOpen { get; set; }
[Parameter] public DTooltipPlacement Placement { get; set; }
[Parameter] public DTooltipAlign Align { get; set; }
[Parameter] public string Class { get; set; }
bool opened;
protected override void OnInitialized() => IsLoading = false;
async Task Open()
{
if (opened || !OnOpen.HasDelegate)
return;
opened = true;
await OnOpen.InvokeAsync();
}
RenderFragment Body => @
@if (Heading is { Length: > 0 })
{
@Heading
}
@foreach (var row in Rows.Where(row => !string.IsNullOrEmpty(row.Value)))
{