using Connected.Annotations; using Connected.Extensions; using Connected.Utilities; using Microsoft.AspNetCore.Components; namespace Connected.Components; public partial class IconButton : ButtonBase { protected string Classname => new CssBuilder("mud-button-root mud-icon-button") .AddClass("mud-button", when: AsButton) .AddClass($"mud-{Color.ToDescriptionString()}-text hover:mud-{Color.ToDescriptionString()}-hover", !AsButton && Color != ThemeColor.Default) .AddClass($"mud-button-{Variant.ToDescriptionString()}", AsButton) .AddClass($"mud-button-{Variant.ToDescriptionString()}-{Color.ToDescriptionString()}", AsButton) .AddClass($"mud-button-{Variant.ToDescriptionString()}-size-{Size.ToDescriptionString()}", AsButton) .AddClass($"mud-ripple", !DisableRipple) .AddClass($"mud-ripple-icon", !DisableRipple && !AsButton) .AddClass($"mud-icon-button-size-{Size.ToDescriptionString()}", when: () => Size != Size.Medium) .AddClass($"mud-icon-button-edge-{Edge.ToDescriptionString()}", when: () => Edge != Edge.False) .AddClass($"mud-button-disable-elevation", DisableElevation) .AddClass(Class) .Build(); protected bool AsButton => Variant != Variant.Text; /// /// The Icon that will be used in the component. /// [Parameter] [Category(CategoryTypes.Button.Behavior)] public string Icon { get; set; } /// /// Title of the icon used for accessibility. /// [Parameter] [Category(CategoryTypes.Button.Behavior)] public string Title { get; set; } /// /// The color of the component. It supports the theme colors. /// [Parameter] [Category(CategoryTypes.Button.Appearance)] public ThemeColor Color { get; set; } = ThemeColor.Default; /// /// The Size of the component. /// [Parameter] [Category(CategoryTypes.Button.Appearance)] public Size Size { get; set; } = Size.Medium; /// /// If set uses a negative margin. /// [Parameter] [Category(CategoryTypes.Button.Appearance)] public Edge Edge { get; set; } /// /// Child content of component, only shows if Icon is null or Empty. /// [Parameter] [Category(CategoryTypes.Button.Behavior)] public RenderFragment ChildContent { get; set; } /// /// The variant to use. /// [Parameter] [Category(CategoryTypes.Button.Appearance)] public Variant Variant { get; set; } = Variant.Text; }