From fbbacc236a79d9d1429a992189eec15038437605 Mon Sep 17 00:00:00 2001 From: Saleh Yusefnejad Date: Sat, 7 Sep 2024 19:27:42 +0330 Subject: [PATCH] feat(blazorui): add FullWidth parameter to BitSeparator #8511 (#8542) --- .../Utilities/Separator/BitSeparator.razor.cs | 11 ++++++++ .../Utilities/Separator/BitSeparator.scss | 2 +- .../Separator/BitSeparatorDemo.razor | 26 +++++++++++++------ .../Separator/BitSeparatorDemo.razor.cs | 15 ++++++++++- 4 files changed, 44 insertions(+), 10 deletions(-) diff --git a/src/BlazorUI/Bit.BlazorUI/Components/Utilities/Separator/BitSeparator.razor.cs b/src/BlazorUI/Bit.BlazorUI/Components/Utilities/Separator/BitSeparator.razor.cs index 30884b87f6..2c0ec12372 100644 --- a/src/BlazorUI/Bit.BlazorUI/Components/Utilities/Separator/BitSeparator.razor.cs +++ b/src/BlazorUI/Bit.BlazorUI/Components/Utilities/Separator/BitSeparator.razor.cs @@ -13,6 +13,12 @@ public partial class BitSeparator : BitComponentBase /// [Parameter] public RenderFragment? ChildContent { get; set; } + /// + /// Renders the separator in full width of its container. + /// + [Parameter, ResetStyleBuilder] + public bool FullWidth { get; set; } + /// /// Whether the element is a vertical separator. /// @@ -34,4 +40,9 @@ protected override void RegisterCssClasses() _ => "bit-spr-ctr" }); } + + protected override void RegisterCssStyles() + { + StyleBuilder.Register(() => FullWidth ? "width:100%" : string.Empty); + } } diff --git a/src/BlazorUI/Bit.BlazorUI/Components/Utilities/Separator/BitSeparator.scss b/src/BlazorUI/Bit.BlazorUI/Components/Utilities/Separator/BitSeparator.scss index 7fea1b8b16..e5a409123e 100644 --- a/src/BlazorUI/Bit.BlazorUI/Components/Utilities/Separator/BitSeparator.scss +++ b/src/BlazorUI/Bit.BlazorUI/Components/Utilities/Separator/BitSeparator.scss @@ -6,8 +6,8 @@ .bit-spr-cnt { position: relative; - display: inline-block; color: $clr-fg-pri; + display: inline-block; background: $clr-bg-pri; } diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Utilities/Separator/BitSeparatorDemo.razor b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Utilities/Separator/BitSeparatorDemo.razor index eb7f6e5a4d..cdb4b44946 100644 --- a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Utilities/Separator/BitSeparatorDemo.razor +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Utilities/Separator/BitSeparatorDemo.razor @@ -12,18 +12,18 @@
- Empty separator +
Empty separator

- Separator with text +
Separator with text
Text
- Separator with icon +
Separator with icon
- +
Item 1 @@ -38,11 +38,11 @@
- +
- Horizontal separator with text +
Horizontal separator with text
Center
Start @@ -51,8 +51,7 @@


- Vertical separator with text -
+
Vertical separator with text

Center Start End @@ -60,5 +59,16 @@
+ + +
While using inside a flex container with align-items css style:
+

+
+ Normal +
+ FullWidth +
+
+
\ No newline at end of file diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Utilities/Separator/BitSeparatorDemo.razor.cs b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Utilities/Separator/BitSeparatorDemo.razor.cs index 8dee391d19..1aa79b922e 100644 --- a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Utilities/Separator/BitSeparatorDemo.razor.cs +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Utilities/Separator/BitSeparatorDemo.razor.cs @@ -10,8 +10,8 @@ public partial class BitSeparatorDemo Type = "BitSeparatorAlignContent", DefaultValue = "BitSeparatorAlignContent.Center", Description = "Where the content should be aligned in the separator.", + LinkType = LinkType.Link, Href = "#separator-align-enum", - LinkType = LinkType.Link }, new() { @@ -21,6 +21,13 @@ public partial class BitSeparatorDemo Description = "The content of the Separator, it can be any custom tag or text." }, new() + { + Name = "FullWidth", + Type = "bool", + DefaultValue = "false", + Description = "Renders the separator in full width of its container." + }, + new() { Name = "Vertical", Type = "bool", @@ -97,6 +104,12 @@ public partial class BitSeparatorDemo Center Start End"; + + private readonly string example4RazorCode = @" +
+ Normal + FullWidth +
"; }