Initial Commit
This commit is contained in:
@@ -0,0 +1,200 @@
|
||||
@inherits LayoutComponentBase
|
||||
@inject INavigationService NavigationService
|
||||
@implements IDisposable
|
||||
|
||||
@{
|
||||
var visibleStyle = NavigationService.GetNavigationSectionId() > 0 ? "clickOffVisible" : "";
|
||||
}
|
||||
|
||||
<div onclick="@MenuClosed" class="clickOffBackground @visibleStyle">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="desktopNavContainer">
|
||||
<div class="menuHeader">
|
||||
<NavLink id="desktop-homeLink" href="/" class="websiteTitle">
|
||||
<i class="fa-solid fa-house" style="margin-right: 4px;"></i> IGP Fan Reference
|
||||
</NavLink>
|
||||
|
||||
<div class="sectionNavs">
|
||||
@foreach (var webSection in WebSections)
|
||||
{
|
||||
var isSelected = NavigationService.GetNavigationSectionId().Equals(webSection.Id);
|
||||
var sectionButtonStyle = "sectionButton";
|
||||
if (isSelected)
|
||||
{
|
||||
sectionButtonStyle += " sectionButtonSelected";
|
||||
}
|
||||
|
||||
<div class="sectionNav">
|
||||
|
||||
<button onclick="@(() => { MenuClicked(webSection.Id); })" class="@sectionButtonStyle">
|
||||
<i class="fa-solid @webSection.Icon"></i>
|
||||
@if (!webSection.OnlyIcon)
|
||||
{
|
||||
<span style="margin-left: 12px">@webSection.Name</span>
|
||||
}
|
||||
</button>
|
||||
@if (isSelected)
|
||||
{
|
||||
<div class="navMenuPosition">
|
||||
<div class="navMenuContainer">
|
||||
<DesktopNavSectionComponent Section="@webSection"/>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<SearchButtonComponent Id="desktop-searchButton"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.clickOffBackground {
|
||||
top: 0;
|
||||
left: 0;
|
||||
position: fixed;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.clickOffBackground.clickOffVisible {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.sectionButton {
|
||||
cursor: pointer;
|
||||
padding: 12px;
|
||||
position: relative;
|
||||
z-index: 50000;
|
||||
}
|
||||
|
||||
.desktopNavContainer {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100vw;
|
||||
height: 40px;
|
||||
background-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.menuHeader {
|
||||
border-bottom: 4px solid black;
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
padding-top: 12px;
|
||||
padding-bottom: 12px;
|
||||
|
||||
padding-left: 24px;
|
||||
padding-right: 24px;
|
||||
|
||||
display: flex;
|
||||
background-color: var(--accent);
|
||||
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
}
|
||||
|
||||
|
||||
.sectionNavs {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.sectionNav {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.websiteTitle {
|
||||
font-weight: bold;
|
||||
color: white;
|
||||
margin-right: 32px;
|
||||
}
|
||||
|
||||
.navMenuPosition {
|
||||
position: relative;
|
||||
top: 18px;
|
||||
left: calc(-50% + -330px / 2);
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.navMenuContainer {
|
||||
width: 330px;
|
||||
flex-direction: row;
|
||||
gap: 20px;
|
||||
align-items: flex-start;
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
padding-top: 4px;
|
||||
padding-bottom: 4px;
|
||||
padding-left: 4px;
|
||||
padding-right: 4px;
|
||||
background-color: rgba(22, 22, 24, 0.95);
|
||||
border: 1px solid black;
|
||||
border-radius: 4px;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.sectionButtonSelected {
|
||||
box-shadow: 0 2px 3px black;
|
||||
background-color: var(--info);
|
||||
transform: translateY(-1px) scale(1.08);
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
@@media only screen and (max-width: 1025px) {
|
||||
.desktopNavContainer {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@@media only screen and (max-width: 480px) {
|
||||
.desktopNavContainer {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
@code {
|
||||
|
||||
[Parameter] public List<WebSectionModel> WebSections { get; set; } = default!;
|
||||
|
||||
[Parameter] public List<WebPageModel> WebPages { get; set; } = default!;
|
||||
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
NavigationService.Subscribe(StateHasChanged);
|
||||
}
|
||||
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
NavigationService.Unsubscribe(StateHasChanged);
|
||||
}
|
||||
|
||||
void MenuClicked(int menuName)
|
||||
{
|
||||
NavigationService.ChangeNavigationSectionId(menuName);
|
||||
}
|
||||
|
||||
void MenuClosed()
|
||||
{
|
||||
NavigationService.ChangeNavigationSectionId(-1);
|
||||
}
|
||||
|
||||
void HoverOut(MouseEventArgs mouseEventArgs)
|
||||
{
|
||||
NavigationService.ChangeNavigationState(NavigationStateType.Default);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
@using Components.Utils
|
||||
@inject INavigationService NavigationService;
|
||||
@inject NavigationManager NavigationManager;
|
||||
|
||||
@if (isOnPage)
|
||||
{
|
||||
<NavLink href="@Page.Href" class="desktopNavLink navSelected">
|
||||
<div class="navName">
|
||||
@Page.Name
|
||||
</div>
|
||||
</NavLink>
|
||||
}
|
||||
else
|
||||
{
|
||||
<NavLink target="@Links.GetTarget(Page.Href)"
|
||||
@onclick="() => { NavigationService.ChangeNavigationState(NavigationStateType.Default); NavigationService.ChangeNavigationSectionId(-1); }"
|
||||
href="@Page.Href" class="desktopNavLink">
|
||||
<div class="navName">
|
||||
@Page.Name
|
||||
</div>
|
||||
</NavLink>
|
||||
}
|
||||
|
||||
<style>
|
||||
|
||||
.navName {
|
||||
margin: auto;
|
||||
color: white;
|
||||
font-size: 1.3rem;
|
||||
font-weight: 600;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
.desktopNavLink {
|
||||
cursor: pointer;
|
||||
height: 60px;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
|
||||
background-color: var(--primary);
|
||||
border: 1px solid var(--primary);
|
||||
}
|
||||
|
||||
.desktopNavLink:first-of-type {
|
||||
border-top-left-radius: 4px;
|
||||
border-top-right-radius: 4px;
|
||||
}
|
||||
|
||||
.desktopNavLink:last-of-type {
|
||||
border-bottom-left-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
}
|
||||
|
||||
.desktopNavLink: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; } = default!;
|
||||
|
||||
bool isOnPage;
|
||||
|
||||
protected override Task OnParametersSetAsync()
|
||||
{
|
||||
var uri = NavigationManager.Uri.Remove(0, NavigationManager.BaseUri.Count()).ToLower();
|
||||
|
||||
isOnPage = Page.Href.ToLower().Equals(uri);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
|
||||
void OnNavigationChanged()
|
||||
{
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
void OnBack()
|
||||
{
|
||||
NavigationService.Back();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<div class="sectionContainer">
|
||||
@foreach (var childPage in Section.WebPageModels)
|
||||
{
|
||||
if (childPage.IsPrivate.Equals("True"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
<DesktopNavLinkComponent Page=childPage></DesktopNavLinkComponent>
|
||||
}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.sectionContainer {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
justify-content: flex-start;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
@code {
|
||||
|
||||
[Parameter] public WebSectionModel Section { get; set; } = default!;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
<div class="mobileFooter">
|
||||
<div class="mobileNavSectionsContainer">
|
||||
@foreach (var webSection in WebSections)
|
||||
{
|
||||
<div class="mobileNavSectionButton" @onclick="() => OnSectionClicked(webSection)"
|
||||
@onclick:preventDefault="true" @onclick:stopPropagation="true">
|
||||
<div class="mobileNavSectionButtonText">
|
||||
<i class="fa-solid @webSection.Icon" style="font-size: 28px;"></i>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
<SearchIconButtonComponent/>
|
||||
</div>
|
||||
|
||||
<div class="fullPageButton @(selectedSection != null)" @onclick="OnPageClicked" @onclick:stopPropagation="false"
|
||||
@onclick:preventDefault="false">
|
||||
</div>
|
||||
|
||||
@if (selectedSection != null)
|
||||
{
|
||||
List<WebPageModel?> webPages = (from page in WebPages
|
||||
where page.WebSectionModelId == selectedSection.Id
|
||||
select page).ToList()!;
|
||||
|
||||
<div class="mobileNavPagesContainer">
|
||||
@foreach (var webPage in webPages)
|
||||
{
|
||||
if (webPage!.IsPrivate.Equals("True"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
<div class="mobileNavPageButton" @onclick="() => OnPageLinkClicked(webPage)"
|
||||
@onclick:preventDefault="true" @onclick:stopPropagation="true">
|
||||
<div class="mobileNavPageButtonText">
|
||||
@webPage.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;
|
||||
border-radius: 2px;
|
||||
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 {
|
||||
#if NO_SQL
|
||||
[Parameter] public List<WebSectionModel> WebSections { get; set; } = default!;
|
||||
|
||||
[Parameter] public List<WebPageModel> WebPages { get; set; } = default!;
|
||||
|
||||
#else
|
||||
[Parameter]
|
||||
public DbSet<WebSectionModel> WebSections { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public DbSet<WebPageModel> WebPages { get; set; }
|
||||
#endif
|
||||
|
||||
[Inject] public NavigationManager NavigationManager { get; set; } = default!;
|
||||
|
||||
|
||||
private WebSectionModel? selectedSection;
|
||||
private 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,184 @@
|
||||
@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="tabletButtons">
|
||||
|
||||
<SearchButtonComponent/>
|
||||
<div class="tabletButton">
|
||||
<div class="tabletMenuTitle">
|
||||
<i class="fa-solid fa-bars" style="font-size: 32px; margin:auto"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="fullPageButton @navOpen" @onclick="OnNavClicked" @onclick:stopPropagation="false"
|
||||
@onclick:preventDefault="false">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="tabletNav @navOpen">
|
||||
@foreach (var webSection in WebSections)
|
||||
{
|
||||
var pages = (from page in WebPages
|
||||
where page.WebSectionModelId == webSection.Id
|
||||
select page).ToList();
|
||||
|
||||
<div>
|
||||
<div>
|
||||
@webSection.Name
|
||||
</div>
|
||||
|
||||
<div class="tabletNavItems">
|
||||
@foreach (var webPage in pages)
|
||||
{
|
||||
if (webPage.IsPrivate.Equals("True"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
<NavLink href="@webPage.Href" class="tabletNavItem" @onclick="OnPageClicked">
|
||||
@webPage.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;
|
||||
}
|
||||
|
||||
.tabletButtons {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
|
||||
.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 {
|
||||
|
||||
#if NO_SQL
|
||||
[Parameter] public List<WebSectionModel> WebSections { get; set; } = default!;
|
||||
|
||||
[Parameter] public List<WebPageModel> WebPages { get; set; } = default!;
|
||||
|
||||
#else
|
||||
[Parameter]
|
||||
public DbSet<WebSectionModel> WebSections { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public DbSet<WebPageModel> WebPages { get; set; }
|
||||
#endif
|
||||
|
||||
|
||||
bool navOpen = true;
|
||||
|
||||
void OnNavClicked(EventArgs eventArgs)
|
||||
{
|
||||
navOpen = !navOpen;
|
||||
}
|
||||
|
||||
|
||||
void OnPageClicked(EventArgs eventArgs)
|
||||
{
|
||||
navOpen = false;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user