From 0e3b71e522d4b319e27ff9a6590b8ed216facbec Mon Sep 17 00:00:00 2001 From: Robert Haken Date: Mon, 5 Aug 2024 12:30:18 +0200 Subject: [PATCH] #863 [HxSidebar] Do not collapse parent item with Href on click when expanded --- .../Navigation/HxSidebarItem.razor | 2 +- .../HxSidebarDoc/HxSidebar_Demo.razor | 36 +++++++++---------- .../HxSidebar_Documentation.razor | 7 +++- 3 files changed, 25 insertions(+), 20 deletions(-) diff --git a/Havit.Blazor.Components.Web.Bootstrap/Navigation/HxSidebarItem.razor b/Havit.Blazor.Components.Web.Bootstrap/Navigation/HxSidebarItem.razor index 8b882a320..51783e8b4 100644 --- a/Havit.Blazor.Components.Web.Bootstrap/Navigation/HxSidebarItem.razor +++ b/Havit.Blazor.Components.Web.Bootstrap/Navigation/HxSidebarItem.razor @@ -85,7 +85,7 @@ Enabled="Enabled" OnClick="HandleExpandableItemClick" role="button" - data-bs-toggle="collapse" + data-bs-toggle="@(expanded && !String.IsNullOrEmpty(Href) ? null : "collapse")" data-bs-target="@("#" + _id)" aria-expanded="@(expanded ? "true" : "false")"> diff --git a/Havit.Blazor.Documentation/Pages/Components/HxSidebarDoc/HxSidebar_Demo.razor b/Havit.Blazor.Documentation/Pages/Components/HxSidebarDoc/HxSidebar_Demo.razor index 610b7f3a8..575454664 100644 --- a/Havit.Blazor.Documentation/Pages/Components/HxSidebarDoc/HxSidebar_Demo.razor +++ b/Havit.Blazor.Documentation/Pages/Components/HxSidebarDoc/HxSidebar_Demo.razor @@ -1,23 +1,23 @@ - - - + + + - - + + - - - - - - - - - - + + + + + + + + + + - - - + + + \ No newline at end of file diff --git a/Havit.Blazor.Documentation/Pages/Components/HxSidebarDoc/HxSidebar_Documentation.razor b/Havit.Blazor.Documentation/Pages/Components/HxSidebarDoc/HxSidebar_Documentation.razor index ebb962b5b..21cd3d6fc 100644 --- a/Havit.Blazor.Documentation/Pages/Components/HxSidebarDoc/HxSidebar_Documentation.razor +++ b/Havit.Blazor.Documentation/Pages/Components/HxSidebarDoc/HxSidebar_Documentation.razor @@ -1,4 +1,5 @@ @attribute [Route("/components/" + nameof(HxSidebar))] +@attribute [Route("/components/" + nameof(HxSidebar) + "/{*RouteCatchAll}")] @attribute [Route("/components/" + nameof(HxSidebarItem))] @attribute [Route("/components/" + nameof(HxSidebarBrand))] @@ -192,4 +193,8 @@ - \ No newline at end of file + + +@code { + [Parameter] public string RouteCatchAll { get; set; } // for the demos +} \ No newline at end of file