@namespace Lumeo

<button class="@CssClass" @onclick="Cancel" @attributes="AdditionalAttributes">
    @ChildContent
</button>

@code {
    [CascadingParameter] public AlertDialog.AlertDialogContext Context { get; set; } = default!;
    [Parameter] public RenderFragment? ChildContent { get; set; }
    [Parameter] public string? Class { get; set; }
    [Parameter(CaptureUnmatchedValues = true)] public Dictionary<string, object>? AdditionalAttributes { get; set; }

    private string CssClass => $"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground h-9 px-4 py-2 mt-2 sm:mt-0 {Class}".Trim();

    private async Task Cancel() => await Context.SetOpen.InvokeAsync(false);
}
