-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#289 - Bottom menu with fixed items.
- Loading branch information
Showing
11 changed files
with
147 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<div class="row my-2 [email protected]"> | ||
@foreach (var item in Items) | ||
{ | ||
<div class="col"> | ||
@if (item.Url != null) | ||
{ | ||
<Match Url="@item.Url" PageType="@item.PageType" Context="IsActive"> | ||
<a href="@item.Url" class="btn btn-block @(IsActive ? "btn-primary" : "btn-light")"> | ||
<Icon Identifier="@item.Icon" /> | ||
<span class="text"> | ||
@item.Text | ||
</span> | ||
</a> | ||
</Match> | ||
} | ||
else | ||
{ | ||
<button @onclick="@item.OnClick" class="btn btn-block btn-light"> | ||
<Icon Identifier="@item.Icon" /> | ||
<span class="text"> | ||
@item.Text | ||
</span> | ||
</button> | ||
} | ||
</div> | ||
} | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using Microsoft.AspNetCore.Components; | ||
using Money.Pages; | ||
using Money.Services; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Money.Layouts | ||
{ | ||
public partial class BottomMenu | ||
{ | ||
[Inject] | ||
protected Navigator Navigator { get; set; } | ||
|
||
protected List<MenuItemModel> Items { get; set; } | ||
|
||
protected async override Task OnInitializedAsync() | ||
{ | ||
await base.OnInitializedAsync(); | ||
|
||
Items = new List<MenuItemModel>() | ||
{ | ||
new MenuItemModel() | ||
{ | ||
Icon = "chart-pie", | ||
Text = "Monthly", | ||
Url = Navigator.UrlSummary(), | ||
PageType = typeof(SummaryMonth) | ||
}, | ||
new MenuItemModel() | ||
{ | ||
Icon = "search", | ||
Text = "Search", | ||
Url = Navigator.UrlSearch() | ||
}, | ||
new MenuItemModel() | ||
{ | ||
Icon = "tag", | ||
Text = "Categories", | ||
Url = Navigator.UrlCategories() | ||
}, | ||
new MenuItemModel() | ||
{ | ||
Icon = "minus-circle", | ||
Text = "New Expense", | ||
OnClick = Navigator.OpenExpenseCreate | ||
} | ||
}; | ||
} | ||
} | ||
|
||
public class MenuItemModel | ||
{ | ||
public string Icon { get; set; } | ||
public string Text { get; set; } | ||
public string Url { get; set; } | ||
public Type PageType { get; set; } | ||
public Action OnClick { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,22 @@ | ||
<li class="nav-item"> | ||
<a href="@Href" class="nav-link @(IsActive() ? "active" : "")"> | ||
@ChildContent | ||
</a> | ||
</li> | ||
<Match Url="@Href" Mode="@HrefMatch" PageType="@PageType" Context="IsActive"> | ||
<li class="nav-item"> | ||
<a href="@Href" class="nav-link @(IsActive ? "active" : "")"> | ||
@ChildContent | ||
</a> | ||
</li> | ||
</Match> | ||
|
||
@code | ||
{ | ||
[Parameter] | ||
public string Href { get; set; } | ||
|
||
[Parameter] | ||
public MatchMode HrefMatch { get; set; } = MatchMode.Exact; | ||
|
||
[Parameter] | ||
public Type PageType { get; set; } | ||
|
||
[Parameter] | ||
public RenderFragment ChildContent { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@ChildContent(IsActive()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
|
||
namespace Money.Layouts | ||
{ | ||
public enum MainMenuLinkMatch | ||
public enum MatchMode | ||
{ | ||
Exact, | ||
StartsWith | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.