Skip to content

Commit

Permalink
Merge pull request #2133 from Nexus-Mods/fix/left-menu-badge-numbers
Browse files Browse the repository at this point in the history
Fix for badge width with larger numbers
  • Loading branch information
erri120 authored Oct 8, 2024
2 parents b4cecb1 + c14a900 commit 91f2e97
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 6 deletions.
28 changes: 28 additions & 0 deletions src/NexusMods.App.UI/LeftMenu/Items/IconDesignViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System.Reactive;
using System.Reactive.Linq;
using NexusMods.App.UI.Controls.Navigation;
using NexusMods.Icons;
using ReactiveUI;
using ReactiveUI.Fody.Helpers;

namespace NexusMods.App.UI.LeftMenu.Items;

public class IconDesignViewModel : AViewModel<IIconViewModel>, IIconViewModel
{
[Reactive] public string Name { get; set; } = "";

[Reactive] public IconValue Icon { get; set; } = new();

[Reactive] public string[] Badges { get; set; } = [];

[Reactive] public ReactiveCommand<NavigationInformation, Unit> NavigateCommand { get; set; } = ReactiveCommand.Create<NavigationInformation>(_ => { }, Observable.Return(true));

[Reactive] public int RelativeOrder { get; set; } = 0;

public IconDesignViewModel() : base()
{
Icon = IconValues.ModLibrary;
Name = "Sample Text";
Badges = new[] { "82" };
}
}
13 changes: 7 additions & 6 deletions src/NexusMods.App.UI/LeftMenu/Items/IconView.axaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<reactiveUi:ReactiveUserControl
d:DesignHeight="40"
d:DesignWidth="184"
d:DesignHeight="50"
d:DesignWidth="300"
mc:Ignorable="d"
x:Class="NexusMods.App.UI.LeftMenu.Items.IconView"
x:TypeArguments="items:IIconViewModel"
Expand All @@ -15,7 +15,7 @@
xmlns:system="clr-namespace:System;assembly=System.Runtime">

<Design.DataContext>
<items:IconViewModel Icon="{x:Static icons:IconValues.ModLibrary}" Name="Some long Text" />
<items:IconDesignViewModel />
</Design.DataContext>

<navigation:NavigationControl Classes="LeftMenuItem"
Expand All @@ -40,16 +40,17 @@
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type system:String}">
<Border Width="20"
Height="20"
<Border
Padding="6,0"
Height="20"
CornerRadius="{StaticResource Rounded-full}"
Background="{StaticResource PrimaryModerate}">
<TextBlock
x:Name="TextBlock"
TextAlignment="Center"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Classes="BodySMBold"
Theme="{StaticResource BodySMBoldTheme}"
Foreground="{StaticResource NeutralInverted}"
Text="{CompiledBinding }"/>
</Border>
Expand Down

0 comments on commit 91f2e97

Please sign in to comment.