using Connected.Annotations; using Connected.Extensions; using Connected.Utilities; using Microsoft.AspNetCore.Components; namespace Connected.Components; public partial class Icon : UIComponent { protected string Classname => new CssBuilder("mud-icon-root") .AddClass($"mud-icon-default", Color == ThemeColor.Default) .AddClass($"mud-svg-icon", !string.IsNullOrEmpty(Glyph) && Glyph.Trim().StartsWith(("<"))) .AddClass($"mud-{Color.ToDescriptionString()}-text", Color != ThemeColor.Default && Color != ThemeColor.Inherit) .AddClass($"mud-icon-size-{Size.ToDescriptionString()}") .AddClass(Class) .Build(); /// /// Icon to be used can either be svg paths for font icons. /// [Parameter] [Category(CategoryTypes.Icon.Behavior)] public string Glyph { get; set; } /// /// Title of the icon used for accessibility. /// [Parameter] [Category(CategoryTypes.Icon.Behavior)] public string Title { get; set; } /// /// The Size of the icon. /// [Parameter] [Category(CategoryTypes.Icon.Appearance)] public Size Size { get; set; } = Size.Medium; /// /// The color of the component. It supports the theme colors. /// [Parameter] [Category(CategoryTypes.Icon.Appearance)] public ThemeColor Color { get; set; } = ThemeColor.Inherit; /// /// The viewbox size of an svg element. /// [Parameter] [Category(CategoryTypes.Icon.Behavior)] public string ViewBox { get; set; } = "0 0 24 24"; /// /// Child content of component. /// [Parameter] [Category(CategoryTypes.Icon.Behavior)] public RenderFragment ChildContent { get; set; } }