mirror of
https://github.com/gwdevhub/Daybreak.git
synced 2026-07-21 01:59:49 +00:00
58 lines
2.0 KiB
Plaintext
58 lines
2.0 KiB
Plaintext
<div class="navigation-panel @(this.IsNavigationOpen ? "open" : "") backdrop-panel">
|
|
<div class="navigation-menu">
|
|
<div class="menu-content">
|
|
@foreach (var category in this.MenuCategories)
|
|
{
|
|
<div class="menu-category">
|
|
<div class="category-header" @onclick="() => this.ToggleCategory(category.Name)">
|
|
<span class="category-title">@category.Name</span>
|
|
<span class="category-arrow @(this.expandedCategories.Contains(category.Name) ? "expanded" : "")">⏷</span>
|
|
</div>
|
|
|
|
@if (this.expandedCategories.Contains(category.Name))
|
|
{
|
|
<div class="category-items">
|
|
@foreach (var button in category.Buttons)
|
|
{
|
|
<div class="menu-item" @onclick="() => this.ExecuteAction(button)">
|
|
<span class="item-title">@button.Name</span>
|
|
<span class="item-description">@button.Hint</span>
|
|
</div>
|
|
}
|
|
</div>
|
|
}
|
|
</div>
|
|
}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@code {
|
|
private HashSet<string> expandedCategories = new();
|
|
|
|
[Parameter]
|
|
public required Action<MenuButton> MenuButtonHandler { get; init; }
|
|
|
|
[Parameter]
|
|
public required List<MenuCategory> MenuCategories { get; init; }
|
|
|
|
[Parameter]
|
|
public required bool IsNavigationOpen { get; init; }
|
|
|
|
private void ToggleCategory(string categoryName)
|
|
{
|
|
if (this.expandedCategories.Contains(categoryName))
|
|
{
|
|
this.expandedCategories.Remove(categoryName);
|
|
}
|
|
else
|
|
{
|
|
this.expandedCategories.Add(categoryName);
|
|
}
|
|
}
|
|
|
|
private void ExecuteAction(MenuButton button)
|
|
{
|
|
this.MenuButtonHandler?.Invoke(button);
|
|
}
|
|
} |