using Connected.Annotations; using Connected.Extensions; using Connected.Utilities; using Microsoft.AspNetCore.Components; namespace Connected.Components; public partial class Button : ButtonBase { protected string Classname => new CssBuilder("mud-button-root mud-button") .AddClass($"mud-button-{Variant.ToDescriptionString()}") .AddClass($"mud-button-{Variant.ToDescriptionString()}-{Color.ToDescriptionString()}") .AddClass($"mud-button-{Variant.ToDescriptionString()}-size-{Size.ToDescriptionString()}") .AddClass($"mud-width-full", FullWidth) .AddClass($"mud-ripple", !DisableRipple) .AddClass($"mud-button-disable-elevation", DisableElevation) .AddClass(Class) .Build(); protected string StartIconClass => new CssBuilder("mud-button-icon-start") .AddClass($"mud-button-icon-size-{Size.ToDescriptionString()}") .AddClass(IconClass) .Build(); protected string EndIconClass => new CssBuilder("mud-button-icon-end") .AddClass($"mud-button-icon-size-{Size.ToDescriptionString()}") .AddClass(IconClass) .Build(); /// /// Icon placed before the text if set. /// [Parameter] [Category(CategoryTypes.Button.Behavior)] public string StartIcon { get; set; } /// /// Icon placed after the text if set. /// [Parameter] [Category(CategoryTypes.Button.Behavior)] public string EndIcon { get; set; } /// /// The color of the icon. It supports the theme colors. /// [Parameter] [Category(CategoryTypes.Button.Appearance)] public ThemeColor IconColor { get; set; } = ThemeColor.Inherit; /// /// Icon class names, separated by space /// [Parameter] [Category(CategoryTypes.Button.Appearance)] public string IconClass { 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; /// /// The variant to use. /// [Parameter] [Category(CategoryTypes.Button.Appearance)] public Variant Variant { get; set; } = Variant.Text; /// /// If true, the button will take up 100% of available width. /// [Parameter] [Category(CategoryTypes.Button.Appearance)] public bool FullWidth { get; set; } /// /// Child content of component. /// [Parameter] [Category(CategoryTypes.Button.Behavior)] public RenderFragment ChildContent { get; set; } }