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/Core/Components/AppBar/FluentAppBarItem.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
@inherits FluentComponentBase

<div id=@Id @attributes="AdditionalAttributes" class="@ClassValue" style="@StyleValue" title="@(Tooltip ?? Text)">
<FluentCounterBadge Count="@Count"
ContainerStyle="display: inline;"
<FluentCounterBadge @ref="@_counterBadge"
Count="@Count"
Style="display: flex; flex-direction: column; align-items: center;"
Appearance="BadgeAppearance.Filled"
Color="BadgeColor.Danger"
Expand Down
11 changes: 11 additions & 0 deletions src/Core/Components/AppBar/FluentAppBarItem.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ namespace Microsoft.FluentUI.AspNetCore.Components;
/// </summary>
public partial class FluentAppBarItem : FluentComponentBase, IAppBarItem
{
private FluentCounterBadge _counterBadge = default!;

/// <summary />
public FluentAppBarItem(LibraryConfiguration configuration) : base(configuration)
{
Expand Down Expand Up @@ -97,6 +99,15 @@ protected override void OnInitialized()
}
}

/// <summary />
protected override void OnAfterRender(bool firstRender)
{
if (firstRender)
{
_counterBadge.SetContainerStyle("display: inline;");
Comment thread
vnbaaij marked this conversation as resolved.
}
}

/// <summary />
protected virtual string? ClassValue => DefaultClassBuilder
.AddClass("fluent-appbar-item")
Expand Down
9 changes: 2 additions & 7 deletions src/Core/Components/Badge/FluentBadge.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,6 @@ public FluentBadge(LibraryConfiguration configuration) : base(configuration) { }
[Parameter]
public sbyte? OffsetY { get; set; }

/// <summary>
/// Gets or sets the CSS styles applied to the badge container.
/// </summary>
[Parameter]
public string? ContainerStyle { get; set; }

/// <summary />
protected override void OnParametersSet()
{
Expand Down Expand Up @@ -153,6 +147,7 @@ protected string GetIconColor()

internal void SetContainerStyle(string style)
{
_containerStyle = style;
_containerStyle = style;
StateHasChanged();
}
}
2 changes: 1 addition & 1 deletion src/Core/Components/Badge/FluentCounterBadge.razor
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@namespace Microsoft.FluentUI.AspNetCore.Components
@using Microsoft.FluentUI.AspNetCore.Components.Extensions
@inherits FluentBadge
<AddTag Name="fluent-counter-badge-container" TagWhen="@(() => _isAttached && _render)" style="@ContainerStyle">
<AddTag Name="fluent-counter-badge-container" TagWhen="@(() => _isAttached && _render)" style="@_containerStyle">
@ChildContent
@if (_render)
{
Expand Down
Loading