Files
decePubClient/Components/Daisy/Navigation/DMegamenuItem.razor
T

30 lines
1.1 KiB
Plaintext
Raw Normal View History

@inherits DComponentBase
@* One item of a DMegamenu: its button and the popover it opens, rendered as siblings because daisyUI pairs them by
position (nth-of-type) among the megamenu's direct children. class and other attributes go on the popover. *@
<button type="button" class="@Cx(HideArrow ? "after:content-none" : null, ButtonClass)" popovertarget="@uid">
@if (Header is null)
{
@Text
}
else
{
@Header
}
</button>
<div @attributes="AdditionalAttributes" id="@uid" popover class="@Cx("text-inherit", Class)">
@ChildContent
</div>
@code {
/// <summary>The button's text; Header replaces it with markup.</summary>
[Parameter] public string Text { get; set; }
[Parameter] public RenderFragment Header { get; set; }
/// <summary>The popover's content: a DMenu or anything else.</summary>
[Parameter] public RenderFragment ChildContent { get; set; }
/// <summary>Drop the arrow daisyUI draws after the button's text (after:content-none).</summary>
[Parameter] public bool HideArrow { get; set; }
[Parameter] public string ButtonClass { get; set; }
readonly string uid = "d" + Guid.NewGuid().ToString("N")[..8];
}