Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/BlazorUI/Bit.BlazorUI.Tests/Navs/BitNavTest.razor
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
RenderType="@RenderType"
Items="Items"
SelectedItem="@SelectedItem"
OnItemClick="OnItemClick"
OnItemExpand="OnItemExpand"
OnItemClick="(BitNavItem item) => OnItemClick(item)"
OnItemToggle="(BitNavItem item) => OnItemExpand(item)"
Mode="@Mode">
</BitNav>
</CascadingValue>
Expand Down
6 changes: 3 additions & 3 deletions src/BlazorUI/Bit.BlazorUI.Tests/Navs/BitNavTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void BitNavLinkItemAriaLabelTest(string collapseAriaLabel, string expandA
CollapseAriaLabel = collapseAriaLabel,
ExpandAriaLabel = expandAriaLabel,
IsExpanded = isExpanded,
Items = new List<BitNavItem>()
ChildItems = new List<BitNavItem>()
{
new BitNavItem() { Text = "Activity", Url = "http://msn.com", Title = "Activity" }
}
Expand Down Expand Up @@ -167,7 +167,7 @@ public void BitNavOnLinkExpandClickTest()
{
var items = new List<BitNavItem>()
{
new() { Text = "Test1", Items = new List<BitNavItem>() { new() { Text = "Test2" } } }
new() { Text = "Test1", ChildItems = new List<BitNavItem>() { new() { Text = "Test2" } } }
};

var componenet = RenderComponent<BitNavTest>(parameters =>
Expand All @@ -193,7 +193,7 @@ public void BitNavLinkItemForceAnchorTest(bool isForced)
new() {
Text = "Test1",
IsExpanded = true,
Items = new List<BitNavItem>() { new() { Text = "Test2", ForceAnchor = isForced } }
ChildItems = new List<BitNavItem>() { new() { Text = "Test2", ForceAnchor = isForced } }
}
};

Expand Down
17 changes: 12 additions & 5 deletions src/BlazorUI/Bit.BlazorUI/Components/Nav/BitNav.razor
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
@namespace Bit.BlazorUI
@using Bit.BlazorUI.Components.Nav
@inherits BitComponentBase
@typeparam TItem
@using Bit.BlazorUI.Components.Nav

@if (ChildContent is not null)
{
<CascadingValue Value="this" IsFixed="true">
@ChildContent
</CascadingValue>
}

<nav @ref="RootElement"
@attributes="HtmlAttributes"
<nav @ref="RootElement" @attributes="HtmlAttributes"
style="@StyleBuilder.Value"
class="@ClassBuilder.Value"
role="navigation"
aria-label="@AriaLabel">

<ul role="list">
<CascadingValue Value="this" IsFixed="true">
@foreach (var childItem in Items)
@foreach (var childItem in _items)
{
<_BitNavChild @key="childItem.Key ?? childItem.Text" Item="childItem" />
<_BitNavChild @key="GetKey(childItem)" Item="childItem" Depth="0" />
}
</CascadingValue>
</ul>
Expand Down
Loading