Add page navigation bar

This commit is contained in:
jvyden 2021-11-19 22:00:08 -05:00
commit a31085c08a
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
4 changed files with 33 additions and 2 deletions

View file

@ -4,4 +4,4 @@
@{
Layout = "Layouts/BaseLayout";
}
test
<p>Welcome to <b>Project Lighthouse</b>.</p>

View file

@ -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>

View file

@ -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"),
};
}
}

View 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; }
}
}