Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AppBar] Allow for omitting Href on AppBarItems and don't show active status when Href is null or not specified #1976

Merged
merged 4 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
IconActive="AppBarIcon(active: true)"
Text="AppBar"
OnClick="HandleOnClick" />
<FluentAppBarItem Href="@(null)"
IconRest="WhatsNewIcon()"
<FluentAppBarItem IconRest="WhatsNewIcon()"
IconActive="WhatsNewIcon(active: true)"
Text="What's New'"
OnClick="ShowSuccessAsync" />
Expand Down
8 changes: 8 additions & 0 deletions src/Core/Components/AppBar/FluentAppBar.razor.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,19 @@
right: unset;
}

::deep .fluent-appbar-item.fluent-appbar-item-local:not(.popover) a.active::before {
all: initial;
}

[dir='rtl'] * ::deep .fluent-appbar-item:not(.popover) a.active::before {
right: calc(var(--design-unit) * 0.5px);
left: unset;
}

[dir='rtl'] * ::deep .fluent-appbar-item.fluent-appbar-item-local:not(.popover) a.active::before {
all: initial;
}

::deep .fluent-popover-content .fluent-popover-body {
margin-top: 0 !important;
}
Expand Down
5 changes: 3 additions & 2 deletions src/Core/Components/AppBar/FluentAppBarItem.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public partial class FluentAppBarItem : FluentComponentBase, IDisposable
/// <summary>
/// Gets or sets the URL for this item.
/// </summary>
[Parameter, EditorRequired]
public required string Href { get; set; }
[Parameter]
public string? Href { get; set; }

/// <summary>
/// Gets or sets how the link should be matched.
Expand Down Expand Up @@ -78,6 +78,7 @@ public partial class FluentAppBarItem : FluentComponentBase, IDisposable
public bool? Overflow { get; private set; }

internal string? ClassValue => new CssBuilder("fluent-appbar-item")
.AddClass("fluent-appbar-item-local", when: Href == null)
vnbaaij marked this conversation as resolved.
Show resolved Hide resolved
.AddClass(Class)
.Build();

Expand Down
Loading