Skip to content

Commit

Permalink
#863 [HxSidebar] Do not collapse parent item with Href on click when …
Browse files Browse the repository at this point in the history
…expanded
  • Loading branch information
hakenr committed Aug 5, 2024
1 parent 70b6354 commit 0e3b71e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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")">

Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<HxSidebar>
<HeaderTemplate>
<HxSidebarBrand BrandName="Brand name" BrandNameShort="BN"/>
</HeaderTemplate>
<HeaderTemplate>
<HxSidebarBrand BrandName="Brand name" BrandNameShort="BN" />
</HeaderTemplate>

<ItemsTemplate>
<HxSidebarItem Text="Dashboard" Href="TEST" Icon="BootstrapIcon.Columns" TooltipText="Dashboard" />
<ItemsTemplate>
<HxSidebarItem Text="Dashboard" Href="/components/HxSidebar/dashboard" Icon="BootstrapIcon.Columns" TooltipText="Dashboard" />
<HxSidebarItem Text="Employees (plain)" Icon="BootstrapIcon.People" TooltipText="Employees (plain)">
<HxSidebarItem Text="Overview" Href="/HxSidebarTest#x1" Match="NavLinkMatch.All"/>
<HxSidebarItem Text="Absences" Href="TEST"/>
</HxSidebarItem>
<HxSidebarItem Text="Mine (with icons)" Href="TEST" Icon="BootstrapIcon.Person">
<HxSidebarItem Text="Overview" Icon="BootstrapIcon.Wallet2" Href="#"/>
<HxSidebarItem Text="Timesheets" Icon="BootstrapIcon.Clock"Href="TEST"/>
<HxSidebarItem Text="Absences" Icon="BootstrapIcon.Exclamation" Href="TEST"/>
</HxSidebarItem>
<HxSidebarItem Text="Administration" Href="TEST" Icon="BootstrapIcon.Gear"/>
</ItemsTemplate>
<HxSidebarItem Text="Overview" Href="/components/HxSidebar/employees" Match="NavLinkMatch.All" />
<HxSidebarItem Text="Absences" Href="/components/HxSidebar/absences" />
</HxSidebarItem>
<HxSidebarItem Text="Mine (with icons)" Href="/components/HxSidebar/mine" Icon="BootstrapIcon.Person">
<HxSidebarItem Text="Overview" Icon="BootstrapIcon.Wallet2" Href="/components/HxSidebar/mine" Match="NavLinkMatch.All" />
<HxSidebarItem Text="Timesheets" Icon="BootstrapIcon.Clock" Href="/components/HxSidebar/mine/timesheets" />
<HxSidebarItem Text="Absences" Icon="BootstrapIcon.Exclamation" Href="/components/HxSidebar/mine/absences" />
</HxSidebarItem>
<HxSidebarItem Text="Administration" Href="/components/HxSidebar/admin" Icon="BootstrapIcon.Gear" />
</ItemsTemplate>

<FooterTemplate>
<HxSidebarFooter Href="/login" Icon="BootstrapIcon.Person" Text="@(context.SidebarCollapsed ? null : "Login")"/>
</FooterTemplate>
<FooterTemplate>
<HxSidebarFooter Href="/components/HxSidebar/login" Icon="BootstrapIcon.Person" Text="@(context.SidebarCollapsed ? null : "Login")" />
</FooterTemplate>
</HxSidebar>
Original file line number Diff line number Diff line change
@@ -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))]

Expand Down Expand Up @@ -192,4 +193,8 @@
</ComponentApiDoc>

<ComponentApiDoc Type="typeof(HxSidebarItem)" />
<ComponentApiDoc Type="typeof(HxSidebarBrand)" />
<ComponentApiDoc Type="typeof(HxSidebarBrand)" />

@code {
[Parameter] public string RouteCatchAll { get; set; } // for the demos
}

0 comments on commit 0e3b71e

Please sign in to comment.