-
- @if (GlyphPosition == Position.Top)
- {
-
- }
+
+
@ChildContent
- @if (GlyphPosition == Position.Bottom)
- {
-
- }
-
diff --git a/src/Connected.Components/Components/ToggleGlyphButton.razor.cs b/src/Connected.Components/Components/ToggleGlyphButton.razor.cs
index eceac3e..1174e03 100644
--- a/src/Connected.Components/Components/ToggleGlyphButton.razor.cs
+++ b/src/Connected.Components/Components/ToggleGlyphButton.razor.cs
@@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
namespace Connected.Components;
-public partial class ToggleGlyphButton: Button
+public partial class ToggleGlyphButton: GlyphButton
{
#region Parameters
@@ -15,13 +15,6 @@ public partial class ToggleGlyphButton: Button
[Parameter]
public bool Toggled { get; set; } = false;
- ///
- /// Glyph (Icon) inside the button.
- /// Options: SVG string --> Icons
- /// Default: string.Empty
- ///
- [Parameter, EditorRequired]
- public string Glyph { get; set; } = string.Empty;
///
/// Glyph (Icon) inside the button when tge .
@@ -31,29 +24,25 @@ public partial class ToggleGlyphButton: Button
[Parameter, EditorRequired]
public string ToggledGlyph { get; set; } = string.Empty;
- ///
- /// Position of the glyph relative to button Text parameter. If Glyph parameter == string.Empty this parameter is ignored
- /// Options: Position.[left,top,right,bottom]
- /// Default: Position.left
- ///
- [Parameter]
- public Position GlyphPosition { get; set; } = Position.Left;
-
///
/// Color for the glyph. If Glyph parameter is empty this parameter is ignored
/// Options: Color.[Core,Primary,Secondary,Success,Info,Warning,Danger,White,Light,Dark]
/// Default: Color.Dark
///
[Parameter]
- public Color GlyphColor { get; set; } = Color.Dark;
+ public Color ToggledGlyphColor { get; set; } = Color.Dark;
- ///
- /// Color for the glyph. If Glyph parameter is empty this parameter is ignored
- /// Options: Color.[Core,Primary,Secondary,Success,Info,Warning,Danger,White,Light,Dark]
- /// Default: Color.Dark
- ///
[Parameter]
- public Color ToggledGlyphColor { get; set; } = Color.Dark;
+ public Color ToggledButtonColor { get; set; } = Color.Success;
+
+ private Color _ButtonColor
+ {
+ get
+ {
+ if (Toggled) return ToggledButtonColor;
+ return base.Color;
+ }
+ }
private string _ShownGlyph
{
@@ -61,7 +50,7 @@ public partial class ToggleGlyphButton: Button
{
if (Toggled)
return ToggledGlyph;
- return Glyph;
+ return base.Glyph;
}
}
@@ -94,8 +83,9 @@ public partial class ToggleGlyphButton: Button
{
return new CssBuilder("btn")
.AddClass("btn-" + Helper.GetEnumDescription(base.Size))
- .AddClass("btn-" + Helper.GetEnumDescription(base.Color),!base.Outlined)
- .AddClass("btn-outline-" + Helper.GetEnumDescription(base.Color), base.Outlined)
+ .AddClass("btn-" + Helper.GetEnumDescription(_ButtonColor),!base.Outlined)
+ .AddClass("btn-outline-" + Helper.GetEnumDescription(_ButtonColor), base.Outlined)
+ .AddClass("wrap")
.AddClass(base.Class)
.Build();
}