From 6e2c6d783606d58f45de3b0b5fe5ee2b0889b16d Mon Sep 17 00:00:00 2001 From: Saleh Yusefnejad Date: Sat, 7 Sep 2024 14:44:51 +0330 Subject: [PATCH 1/3] add FullWidth parameter to BitSeparator #8511 --- .../Utilities/Separator/BitSeparator.razor.cs | 11 ++++++++++ .../Utilities/Separator/BitSeparator.scss | 2 +- .../Separator/BitSeparatorDemo.razor | 22 ++++++++++++++----- .../Separator/BitSeparatorDemo.razor.cs | 6 +++++ 4 files changed, 34 insertions(+), 7 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..bbe1e9f77f 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,13 +12,13 @@
- Empty separator +
Empty separator

- Separator with text +
Separator with text
Text
- Separator with icon +
Separator with icon
@@ -42,7 +42,7 @@
- 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..2f6c175804 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 @@ -97,6 +97,12 @@ public partial class BitSeparatorDemo Center Start End"; + + private readonly string example4RazorCode = @" +
+ Normal + FullWidth +
"; } From 9769d62b6fa55e8b0aba370982faca714a6184e5 Mon Sep 17 00:00:00 2001 From: Saleh Yusefnejad Date: Sat, 7 Sep 2024 14:47:05 +0330 Subject: [PATCH 2/3] fix demo --- .../Utilities/Separator/BitSeparatorDemo.razor.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 2f6c175804..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", From 7913bafa21421576e732f1ed0357947ebbd1c7dd Mon Sep 17 00:00:00 2001 From: Saleh Yusefnejad Date: Sat, 7 Sep 2024 15:43:05 +0330 Subject: [PATCH 3/3] fix demo sections id --- .../Components/Utilities/Separator/BitSeparatorDemo.razor | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 bbe1e9f77f..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 @@ -23,7 +23,7 @@
- +
Item 1 @@ -38,7 +38,7 @@
- +