@inherits LocalizableComponentBase @* Nerd stats on hover or focus: a DTooltip whose content is the rows (NerdRows). A touch screen has no hover, so there a tap opens the same rows in a sheet from the bottom (TapOpens; not for a trigger that is a link itself, the pictures). OnOpen runs on the first hover, focus or tap, for stats read on demand (a post's provenance). *@ @if (TapOpens) { @* (on touch the trigger is at least 44px: daisyUI's tooltip draws its arrow with ::after, so padding-free min sizes) *@ @ChildContent } else { @ChildContent } @if (isSheetOpen) { @Heading } @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; } /// A tap opens the rows in a sheet where the screen has no hover. [Parameter] public bool TapOpens { get; set; } = true; bool opened; bool isSheetOpen; async Task Tap() { if (CascadingState.Status.CanHover()) return; isSheetOpen = true; await Open(); } protected override void OnInitialized() => IsLoading = false; async Task Open() { if (opened || !OnOpen.HasDelegate) return; opened = true; await OnOpen.InvokeAsync(); } RenderFragment Body => @; }