Skip to content

Commit

Permalink
feat(blazorui): add FixedColor parameter to BitButton #8641 (#8642)
Browse files Browse the repository at this point in the history
  • Loading branch information
msynk authored Sep 14, 2024
1 parent 45c157d commit d8ef135
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ public partial class BitButton : BitComponentBase
[Parameter, ResetClassBuilder]
public BitColor? Color { get; set; }

/// <summary>
/// Preserves the foreground color of the button through hover and focus.
/// </summary>
[Parameter, ResetClassBuilder]
public bool FixedColor { get; set; }

/// <summary>
/// The value of the href attribute of the link rendered by the button. If provided, the component will be rendered as an anchor tag instead of button.
/// </summary>
Expand Down Expand Up @@ -203,6 +209,8 @@ protected override void RegisterCssClasses()
});

ClassBuilder.Register(() => ReversedIcon ? "bit-btn-rvi" : string.Empty);

ClassBuilder.Register(() => FixedColor ? "bit-btn-ftc" : string.Empty);
}

protected override void RegisterCssStyles()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@
}
}

.bit-btn-ftc {
color: var(--bit-btn-clr-txt);
}


.bit-btn-pri {
--bit-btn-clr: #{$clr-pri};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ public partial class BitButtonDemo
Href = "#color-enum",
},
new()
{
Name = "FixedColor",
Type = "bool",
DefaultValue = "false",
Description = "Preserves the foreground color of the button through hover and focus.",
},
new()
{
Name = "Href",
Type = "string?",
Expand Down

0 comments on commit d8ef135

Please sign in to comment.