mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-29 08:28:39 +00:00
Add page navigation bar
This commit is contained in:
parent
4738684f6e
commit
a31085c08a
4 changed files with 33 additions and 2 deletions
|
@ -4,4 +4,4 @@
|
|||
@{
|
||||
Layout = "Layouts/BaseLayout";
|
||||
}
|
||||
test
|
||||
<p>Welcome to <b>Project Lighthouse</b>.</p>
|
|
@ -1,4 +1,5 @@
|
|||
@using LBPUnion.ProjectLighthouse.Helpers
|
||||
@using LBPUnion.ProjectLighthouse.Types
|
||||
@model LBPUnion.ProjectLighthouse.Pages.Layouts.BaseLayout
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
@ -7,6 +8,14 @@
|
|||
<head>
|
||||
<title>Project Lighthouse</title>
|
||||
</head>
|
||||
<header>
|
||||
<nav>
|
||||
@foreach (PageNavigationItem navigationItem in Model!.NavigationItems)
|
||||
{
|
||||
<a href="@navigationItem.Url">@navigationItem.Name</a>
|
||||
}
|
||||
</nav>
|
||||
</header>
|
||||
<body>
|
||||
@RenderBody()
|
||||
</body>
|
||||
|
|
|
@ -1,7 +1,16 @@
|
|||
using System.Collections.Generic;
|
||||
using LBPUnion.ProjectLighthouse.Types;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace LBPUnion.ProjectLighthouse.Pages.Layouts
|
||||
{
|
||||
public class BaseLayout : PageModel
|
||||
{}
|
||||
{
|
||||
public readonly List<PageNavigationItem> NavigationItems = new()
|
||||
{
|
||||
new PageNavigationItem("Home", "/"),
|
||||
new PageNavigationItem("Register", "/register"),
|
||||
new PageNavigationItem("Login", "/login"),
|
||||
};
|
||||
}
|
||||
}
|
13
ProjectLighthouse/Types/PageNavigationItem.cs
Normal file
13
ProjectLighthouse/Types/PageNavigationItem.cs
Normal file
|
@ -0,0 +1,13 @@
|
|||
namespace LBPUnion.ProjectLighthouse.Types
|
||||
{
|
||||
public class PageNavigationItem
|
||||
{
|
||||
public PageNavigationItem(string name, string url)
|
||||
{
|
||||
this.Name = name;
|
||||
this.Url = url;
|
||||
}
|
||||
public string Name { get; set; }
|
||||
public string Url { get; set; }
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue