Initial commit

This commit is contained in:
2022-03-28 18:44:08 -04:00
commit e43d9a90e7
267 changed files with 17049 additions and 0 deletions
@@ -0,0 +1,120 @@
@inherits LayoutComponentBase
@inject INavigationService NavigationService
@using Services
@using Model.Website
@using Model.Website.Enums
@using Microsoft.EntityFrameworkCore
@implements IDisposable
<div onmouseleave="@HoverOut" class="desktopNavContainer">
<div class="menuHeader" @onmouseover="() => NavigationService.ChangeNavigationState(NavigationStateType.Hovering_Menu)">
<NavLink href="/" class="websiteTitle">
IGP Fan Reference
</NavLink>
@foreach (var webSection in WebSections) {
<div>@webSection.Name</div>
}
</div>
@{
var hoveredStyle = NavigationStateType.Hovering_Menu.Equals(NavigationService.GetNavigationState()) ?
"navMenuContainerShow" : "";
}
<div class="navMenuContainer @hoveredStyle">
@foreach (var section in WebSections) {
var pages = (from page in WebPages
where page.WebSectionModelId == section.Id
select page).ToList();
<NavSectionComponent Section=section Children=pages/>
}
</div>
</div>
<style>
.desktopNavContainer {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 40px;
background-color: rgba(255,255,255,0.1);
z-index: 1001;
}
.menuHeader {
border-bottom: 4px solid black;
position: fixed;
width: 100%;
padding: 12px;
display: flex;
justify-content: center;
gap: 32px;
height: 50px;
background-color: var(--accent);
}
.websiteTitle {
font-weight: bold;
color: white;
}
.navMenuContainer {
display: none;
position: fixed;
top: 50px;
flex-direction: row;
gap: 20px;
width: 100%;
align-items: flex-start;
justify-content: center;
flex-wrap: wrap;
border-bottom: 4px solid black;
padding-top: 20px;
padding-bottom: 20px;
background-color: rgba(22, 22, 24, 0.95);
}
.navMenuContainerShow {
display: flex;
}
@@media only screen and (max-width: 1025px) {
.desktopNavContainer {
display: none;
}
}
@@media only screen and (max-width: 480px) {
.desktopNavContainer {
display: none;
}
}
</style>
@code {
[Parameter]
public DbSet<WebSectionModel> WebSections { get; set; }
[Parameter]
public DbSet<WebPageModel> WebPages { get; set; }
protected override void OnInitialized() {
NavigationService.Subscribe(StateHasChanged);
}
void IDisposable.Dispose() {
NavigationService.Unsubscribe(StateHasChanged);
}
void HoverOut(MouseEventArgs mouseEventArgs) {
Console.WriteLine(NavigationStateType.Default);
NavigationService.ChangeNavigationState(NavigationStateType.Default);
}
}
@@ -0,0 +1,170 @@
@using Model.Website
@using Microsoft.EntityFrameworkCore
<div class="mobileFooter">
<div class="mobileNavSectionsContainer">
@foreach (var _section in WebSections) {
<div class="mobileNavSectionButton" @onclick="() => OnSectionClicked(_section)" @onclick:preventDefault="true" @onclick:stopPropagation="true">
<div class="mobileNavSectionButtonText">
@_section.Name
</div>
</div>
}
</div>
<div class="fullPageButton @(selectedSection != null)" @onclick="OnPageClicked" @onclick:stopPropagation="false" @onclick:preventDefault="false">
</div>
@if (selectedSection != null) {
var pages = (from page in WebPages
where page.WebSectionModelId == selectedSection.Id
select page).ToList();
<div class="mobileNavPagesContainer">
@foreach (var _page in pages) {
if (_page.IsPrivate.Equals("True")) {
continue;
}
<div class="mobileNavPageButton" @onclick="() => OnPageLinkClicked(_page)" @onclick:preventDefault="true" @onclick:stopPropagation="true">
<div class="mobileNavPageButtonText">
@_page.Name
</div>
</div>
}
</div>
}
</div>
<style>
fullPageButton {
position: fixed;
width: 100vw;
height: 100vh;
bottom: 0;
display: none;
background-color: rgba(0,0,0,0.6);
}
.fullPageButton.True {
display: block;
}
.mobileFooter {
position: fixed;
background-color: rgba(0,0,0,1);
width: 100vw;
bottom: 0;
display: none;
}
.mobileNavPagesContainer {
position: fixed;
display: flex;
flex-direction: column;
bottom: 0;
width: 100vw;
background-color: black;
padding-bottom: 6px;
padding-top: 6px;
padding-left: 4px;
padding-right: 4px;
gap: 2px;
}
.mobileNavSectionsContainer {
display: grid;
grid-auto-columns: 1fr;
grid-auto-flow: column;
width: 100%;
padding-bottom: 6px;
padding-top: 6px;
padding-left: 4px;
padding-right: 4px;
gap: 2px;
}
.mobileNavSectionButton {
border: 1px solid var(--primary);
width: 100%;
height: 64px;
display: flex;
background-color: var(--primary);
cursor: pointer;
}
.mobileNavPageButton {
border: 1px solid var(--primary);
width: 100%;
height: 64px;
display: flex;
background-color: var(--primary);
cursor: pointer;
}
.mobileNavPageButton:hover {
background-color: var(--primary-hover);
border-color: var(--primary-border-hover);
}
.mobileNavSectionButton:hover {
background-color: var(--primary-hover);
border-color: var(--primary-border-hover);
}
.mobileNavSectionButtonText {
font-size: 0.75rem;
text-align: center;
margin: auto;
font-weight: bolder;
}
.mobileNavPageButtonText {
font-size: 1.1rem;
text-align: center;
margin: auto;
font-weight: bolder;
}
@@media only screen and (max-width: 480px) {
.mobileFooter {
display: block;
}
}
</style>
@code {
[Parameter]
public DbSet<WebSectionModel> WebSections { get; set; }
[Parameter]
public DbSet<WebPageModel> WebPages { get; set; }
[Inject]
public NavigationManager NavigationManager { get; set; }
public WebSectionModel selectedSection;
public WebPageModel selectedPage;
void OnSectionClicked(WebSectionModel webSection) {
selectedSection = webSection;
}
void OnPageLinkClicked(WebPageModel webPage) {
selectedPage = webPage;
selectedSection = null;
NavigationManager.NavigateTo(webPage.Href);
}
void OnPageClicked(EventArgs eventArgs) {
selectedPage = null;
selectedSection = null;
}
}
@@ -0,0 +1,84 @@
@using Services
@using Model.Website
@using Model.Website.Enums
@inject INavigationService NavigationService;
@inject NavigationManager NavigationManager;
@if (IsOnPage) {
<NavLink href="@Page.Href" class="navContainer navLink navSelected">
<div class="navName">
@Page.Name
</div>
</NavLink>
}
else {
<NavLink @onclick="() => NavigationService.ChangeNavigationState(NavigationStateType.Default)" href="@Page.Href" class="navContainer navLink">
<div class="navName">
@Page.Name
</div>
</NavLink>
}
<style>
.navContainer {
cursor: pointer;
border: 2px solid black;
border: none;
height: 60px;
width: 100%;
display: block;
display: flex;
border: none;
}
.navName {
margin: auto;
color: white;
font-size: 1.3rem;
font-weight: 600;
text-align: center;
}
.navLink {
background-color: var(--primary);
border: 1px solid var(--primary);
}
.navLink:hover {
color: #8EC3FF;
background-color: var(--primary-hover);
border-color: var(--primary-border-hover);
}
.navSelected {
background-color: var(--primary-hover);
}
</style>
@code {
[Parameter]
public WebPageModel Page { get; set; }
bool IsOnPage = false;
protected override async Task OnParametersSetAsync() {
var uri = NavigationManager.Uri.Remove(0, NavigationManager.BaseUri.Count()).ToLower();
IsOnPage = Page.Href.ToLower().Equals(uri);
}
void OnNavigationChanged() {
StateHasChanged();
}
void OnBack() {
NavigationService.Back();
}
}
@@ -0,0 +1,58 @@
@using Model.Website
<div class="sectionContainer">
<div class="sectionHeader">
<div class="sectionTitle">
@Section.Name
</div>
</div>
@foreach (var childPage in Children) {
if (childPage.IsPrivate.Equals("True")) {
continue;
}
<NavLinkComponent Page=childPage></NavLinkComponent>
}
</div>
<style>
.sectionContainer {
display: flex;
flex-direction: column;
gap: 4px;
justify-content: flex-start;
position: relative;
margin-top: 12px;
padding: 18px;
width: 300px;
margin-left: 4px;
}
.sectionHeader {
bottom: 100%;
position: absolute;
top: 0px;
left: -8px;
padding-right: 12px;
padding-left: 4px;
width: 100%;
display: flex;
line-height: 0px;
}
.sectionTitle {
font-weight: bold;
padding-right: 8px;
margin-top: -2px;
white-space: pre;
}
</style>
@code {
[Parameter]
public WebSectionModel? Section { get; set; }
[Parameter]
public List<WebPageModel>? Children { get; set; }
}
@@ -0,0 +1,163 @@
@using Model.Website
@using Microsoft.EntityFrameworkCore
@inherits LayoutComponentBase
<div class="tablet">
<div class="tabletHeader" @onclick="OnNavClicked" @onclick:preventDefault="true" @onclick:stopPropagation="true">
<div class="tabletTitle">
IGP Fan Reference
</div>
<div class="tabletButton">
<div class="tabletMenuTitle">
Menu
</div>
</div>
</div>
<div class="fullPageButton @NavOpen" @onclick="OnNavClicked" @onclick:stopPropagation="false" @onclick:preventDefault="false">
</div>
<div class="tabletNav @NavOpen">
@foreach (var _section in WebSections) {
var pages = (from page in WebPages
where page.WebSectionModelId == _section.Id
select page).ToList();
<div>
<div>
@_section.Name
</div>
<div class="tabletNavItems">
@foreach (var _page in pages) {
if (_page.IsPrivate.Equals("True")) {
continue;
}
<NavLink href="@_page.Href" class="tabletNavItem" @onclick="OnPageClicked">
@_page.Name
</NavLink>
}
</div>
</div>
}
</div>
</div>
<style>
.fullPageButton {
position: fixed;
width: 100vw;
height: 100vh;
bottom: 0;
display: none;
background-color: rgba(0,0,0,0.6);
}
.fullPageButton.True {
display: block;
}
.tablet {
display: none;
}
.tabletNav {
position: fixed;
background-color: rgba(30,30,30,0.98);
display: none;
height: 100vh;
padding: 32px;
overflow-y: auto;
overflow-x: hidden;
top: 0px;
gap: 22px;
flex-direction: column;
}
.tabletNavItem {
padding: 8px;
}
.tabletNavItems {
display: flex;
flex-direction: column;
}
.tabletNav.True {
display: flex;
}
.tabletHeader {
height: 60px;
width: 100vw;
position: fixed;
top: 0;
display: flex;
background-color: var(--accent);
border-bottom: 4px solid rgba(0,0,0,0.95);
justify-content: space-between;
}
.tabletMenuTitle {
margin: auto;
font-weight: 700;
}
.tabletTitle {
margin: auto;
font-weight: 700;
font-size: 1.4rem;
}
.tabletButton {
border: 2px solid black;
background-color: rgba(0,0,0,0.3);
width: 80px;
height: 100%;
display: flex;
cursor: pointer;
}
.tabletButton:hover {
background-color: rgba(0,0,0,0.7);
}
@@media only screen and (max-width: 1025px) {
.tablet {
display: block;
}
}
@@media only screen and (max-width: 480px) {
.tablet {
display: none;
}
}
</style>
@code {
[Parameter]
public DbSet<WebSectionModel> WebSections { get; set; }
[Parameter]
public DbSet<WebPageModel> WebPages { get; set; }
bool NavOpen = true;
void OnNavClicked(EventArgs eventArgs) {
NavOpen = !NavOpen;
}
void OnPageClicked(EventArgs eventArgs) {
NavOpen = false;
}
}