diff options
Diffstat (limited to 'GitRepoViewer/Shared/NavMenu.razor')
-rw-r--r-- | GitRepoViewer/Shared/NavMenu.razor | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/GitRepoViewer/Shared/NavMenu.razor b/GitRepoViewer/Shared/NavMenu.razor new file mode 100644 index 0000000..3635bcb --- /dev/null +++ b/GitRepoViewer/Shared/NavMenu.razor @@ -0,0 +1,61 @@ +<div class="top-row ps-3 navbar navbar-dark"> + <div class="container-fluid"> + <a class="navbar-brand" href="">GitRepoViewer</a> + <button title="Navigation menu" class="navbar-toggler" @onclick="ToggleNavMenu"> + <span class="navbar-toggler-icon"></span> + </button> + </div> +</div> + +<div class="@NavMenuCssClass nav-scrollable" @onclick="ToggleNavMenu"> + <nav class="flex-column"> + <div class="nav-item px-3"> + <NavLink class="nav-link" href="" Match="NavLinkMatch.All"> + <span class="oi oi-home" aria-hidden="true"></span> Home + </NavLink> + </div> + <div class="nav-item px-3"> + <NavLink class="nav-link" href="counter"> + <span class="oi oi-plus" aria-hidden="true"></span> Counter + </NavLink> + </div> + <div class="nav-item px-3"> + <NavLink class="nav-link" href="fetchdata"> + <span class="oi oi-list-rich" aria-hidden="true"></span> Fetch data + </NavLink> + </div> + @if (repoUrl != null) + { + <div class="nav-item px-3"> + <NavLink class="nav-link" href="@("/GitLog?repo="+repoUrl)"> + <span class="oi oi-list-rich" aria-hidden="true"></span> Commit log + </NavLink> + </div> + } + </nav> +</div> + +@code { + private bool collapseNavMenu = true; + + private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null; + + + private string? repoUrl { get; set; } = null; + + private void ToggleNavMenu() + { + collapseNavMenu = !collapseNavMenu; + } + + + protected override async Task OnInitializedAsync() + { + var query = new Uri(NavigationManager.Uri).Query; + var queryDictionary = System.Web.HttpUtility.ParseQueryString(query); + repoUrl = queryDictionary["repo"]; + + await base.OnInitializedAsync(); + } + +} \ No newline at end of file |