Fan website of IMMORTAL: Gates of Pyre.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

129 lines
3.0 KiB

@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);
}
.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 {
#if NO_SQL
[Parameter]
public List<WebSectionModel> WebSections { get; set; }
[Parameter]
public List<WebPageModel> WebPages { get; set; }
#else
[Parameter]
public DbSet<WebSectionModel> WebSections { get; set; }
[Parameter]
public DbSet<WebPageModel> WebPages { get; set; }
#endif
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);
}
}