@using Microsoft.AspNetCore.Components.Web; @using Nejcraft.Shared.Parts @inherits NejComponentBase @code { [Parameter] public RenderFragment ChildContent { get; set; } = default!; public enum ButtonType { Normal, Submit, Danger } public static Dictionary ColorMap = new Dictionary(){ { ButtonType.Submit, Colors.ColorType.Accent }, { ButtonType.Danger, Colors.ColorType.Error } }; string Color { get { if (!ColorMap.TryGetValue(Type, out Colors.ColorType col)) return "bg-secondary"; return Colors.BgColors[col]; } } string HoverColor { get { if (!ColorMap.TryGetValue(Type, out Colors.ColorType col)) return "hover:bg-trinary"; return Colors.BgColorsHover[col]; } } string DisabledColor { get { if (!ColorMap.TryGetValue(Type, out Colors.ColorType col)) return "disabled:bg-trinary"; return Colors.BgColorsDisabled[col]; } } [Parameter] public ButtonType Type { get; set; } [Parameter] public string? HtmlButtonType { get; set; } = "button"; [Parameter] public EventCallback OnClick { get; set; } }