Skip to content

Commit

Permalink
Add non-interactive state in BitBreadcrumb (bitfoundation#9040)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyrus-Sushiant committed Oct 31, 2024
1 parent 1c571cb commit 7d3b240
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
}
</a>
}
else
else if (OnItemClick.HasDelegate)
{
<button type="button"
aria-current="@(GetIsSelected(item) ? "page" : null)"
Expand All @@ -93,6 +93,30 @@
}
</button>
}
else
{
<span aria-current="@(GetIsSelected(item) ? "page" : null)"
style="@GetStyles(item, false)"
class="bit-brc-itm bit-brc-noc @GetClasses(item, false)">
@if (template is not null)
{
@template(item)
}
else if (ItemTemplate is not null)
{
@ItemTemplate(item)
}
else
{
var iconName = GetIconName(item);
@if (iconName.HasValue())
{
<i style="@Styles?.ItemIcon" class="bit-icon bit-icon--@iconName @Classes?.ItemIcon" />
}
<span style="@Styles?.ItemText" class="@Classes?.ItemText">@GetItemText(item)</span>
}
</span>
}
}
</li>

Expand Down Expand Up @@ -148,7 +172,7 @@
}
</a>
}
else
else if (OnItemClick.HasDelegate)
{
<button type="button"
aria-current="@(GetIsSelected(item) ? "page" : null)"
Expand All @@ -174,6 +198,30 @@
}
</button>
}
else
{
<span aria-current="@(GetIsSelected(item) ? "page" : null)"
style="@GetStyles(item, true)"
class="bit-brc-ofi bit-brc-noc @GetClasses(item, true)">
@if (overflowTemplate is not null)
{
@overflowTemplate(item)
}
else if (OverflowTemplate is not null)
{
@OverflowTemplate(item)
}
else
{
var iconName = GetIconName(item);
@if (iconName.HasValue())
{
<i style="@Styles?.OverflowItemIcon" class="bit-icon bit-icon--@iconName @Classes?.OverflowItemIcon" />
}
<span style="@Styles?.OverflowItemText" class="@Classes?.OverflowItemText">@GetItemText(item)</span>
}
</span>
}
</li>
}
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ private async Task HandleOnItemClick(TItem item)
{
if (IsEnabled is false) return;
if (GetIsEnabled(item) is false) return;
if (OnItemClick.HasDelegate is false) return;

await OnItemClick.InvokeAsync(item);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,16 @@
}
}

.bit-brc-noc {
cursor: default;

@media (hover: hover) {
&:hover {
background-color: inherit;
}
}
}

.bit-brc-ovl {
top: 0;
left: 0;
Expand Down

0 comments on commit 7d3b240

Please sign in to comment.