From 2102b4ce98b8e20d6a97445eeb03842473e51ad1 Mon Sep 17 00:00:00 2001 From: Saleh Yusefnejad Date: Fri, 27 Sep 2024 13:58:25 +0330 Subject: [PATCH] feat(blazorui): add Responsive parameter to BitDropMenu #8774 (#8778) --- .../Navs/DropMenu/BitDropMenu.razor.cs | 7 +++++- .../Components/Navs/DropMenu/BitDropMenu.scss | 13 +++++++++++ .../Navs/DropMenu/BitDropMenuDemo.razor | 22 +++++++++++++++---- .../Navs/DropMenu/BitDropMenuDemo.razor.cs | 7 ++++++ .../DropMenu/BitDropMenuDemo.razor.samples.cs | 18 +++++++++++---- 5 files changed, 58 insertions(+), 9 deletions(-) diff --git a/src/BlazorUI/Bit.BlazorUI/Components/Navs/DropMenu/BitDropMenu.razor.cs b/src/BlazorUI/Bit.BlazorUI/Components/Navs/DropMenu/BitDropMenu.razor.cs index fda15169ca..65428b4ede 100644 --- a/src/BlazorUI/Bit.BlazorUI/Components/Navs/DropMenu/BitDropMenu.razor.cs +++ b/src/BlazorUI/Bit.BlazorUI/Components/Navs/DropMenu/BitDropMenu.razor.cs @@ -49,6 +49,11 @@ public partial class BitDropMenu : BitComponentBase /// [Parameter] public EventCallback OnClick { get; set; } + /// + /// Renders the drop menu in responsive mode on small screens. + /// + [Parameter] public bool Responsive { get; set; } + /// /// Custom CSS styles for different parts of the drop menu. /// @@ -143,7 +148,7 @@ await _js.ToggleCallout(_dotnetObj, _calloutId, null, IsOpen, - BitResponsiveMode.None, + Responsive ? BitResponsiveMode.Panel : BitResponsiveMode.None, BitDropDirection.TopAndBottom, Dir is BitDir.Rtl, "", diff --git a/src/BlazorUI/Bit.BlazorUI/Components/Navs/DropMenu/BitDropMenu.scss b/src/BlazorUI/Bit.BlazorUI/Components/Navs/DropMenu/BitDropMenu.scss index 146bd48e7c..9858b24068 100644 --- a/src/BlazorUI/Bit.BlazorUI/Components/Navs/DropMenu/BitDropMenu.scss +++ b/src/BlazorUI/Bit.BlazorUI/Components/Navs/DropMenu/BitDropMenu.scss @@ -26,6 +26,12 @@ cursor: default; } } + + &.bit-rtl { + .bit-drm-rsp { + animation-name: bit-fade-show, bit-drp-trans-x-reverse; + } + } } .bit-drm-btn { @@ -79,3 +85,10 @@ animation-name: bit-fade-show, bit-slide-down; animation-timing-function: cubic-bezier(0.1, 0.9, 0.2, 1); } + +.bit-drm-rsp { + height: 100%; + max-height: unset; + box-shadow: $box-shadow-callout; + animation-name: bit-fade-show, bit-drp-trans-x; +} diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/DropMenu/BitDropMenuDemo.razor b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/DropMenu/BitDropMenuDemo.razor index 55d275a42e..93484ff7ff 100644 --- a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/DropMenu/BitDropMenuDemo.razor +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/DropMenu/BitDropMenuDemo.razor @@ -53,7 +53,21 @@ - + + +
Rendering the callout in responsive mode on small screens.

+ + + This is the content + This is the content + This is the content + This is the content + + +
+
+ +
Here is an example of customizing the drop menu.

@@ -73,7 +87,7 @@
- +
Utilizing the drop menu OnClick event:

@@ -84,7 +98,7 @@
- +
Further customization by overriding default styles and classes, allowing tailored design modifications to suit specific UI requirements.


@@ -126,7 +140,7 @@
- +
Use BitDropMenu in right-to-left (RTL).

diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/DropMenu/BitDropMenuDemo.razor.cs b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/DropMenu/BitDropMenuDemo.razor.cs index c081320c51..91ff3d61b1 100644 --- a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/DropMenu/BitDropMenuDemo.razor.cs +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/DropMenu/BitDropMenuDemo.razor.cs @@ -56,6 +56,13 @@ public partial class BitDropMenuDemo Description = "The callback is called when the drop menu is clicked." }, new() + { + Name = "Responsive", + Type = "bool", + DefaultValue = "false", + Description = "Renders the drop menu in responsive mode on small screens." + }, + new() { Name = "Styles", Type = "BitDropMenuClassStyles?", diff --git a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/DropMenu/BitDropMenuDemo.razor.samples.cs b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/DropMenu/BitDropMenuDemo.razor.samples.cs index b4f1b0847e..19f478b725 100644 --- a/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/DropMenu/BitDropMenuDemo.razor.samples.cs +++ b/src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Pages/Components/Navs/DropMenu/BitDropMenuDemo.razor.samples.cs @@ -41,6 +41,16 @@ public partial class BitDropMenuDemo "; private readonly string example3RazorCode = @" + + + This is the content + This is the content + This is the content + This is the content + +"; + + private readonly string example4RazorCode = @"