test(SearchTest) Added a test for opening and closing search dialog
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IJSRuntime JsRuntime
|
||||
|
||||
<button class="searchButtonContainer" @onclick="ButtonClicked">
|
||||
<button id="@Id" class="searchButtonContainer" @onclick="ButtonClicked">
|
||||
<div class="searchText">
|
||||
Search...
|
||||
</div>
|
||||
@@ -33,15 +33,15 @@
|
||||
background-color: var(--info);
|
||||
border: 2px solid var(--primary-border);
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
@code {
|
||||
|
||||
[Parameter]
|
||||
public RenderFragment ChildContent { get; set; } = default!;
|
||||
|
||||
[Parameter]
|
||||
public string Id { get; set; } = default!;
|
||||
|
||||
private string userAgent = "";
|
||||
|
||||
string CommandKey => userAgent.Contains("Mac OS") ? "CMD" : "Ctrl";
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
@inject ISearchService SearchService
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IJSRuntime JsRuntime
|
||||
|
||||
<button id="@Id" class="searchIconButtonContainer" @onclick="ButtonClicked">
|
||||
<div class="searchText">
|
||||
S
|
||||
</div>
|
||||
</button>
|
||||
|
||||
<style>
|
||||
.searchIconButtonContainer {
|
||||
background-color: var(--primary);
|
||||
border: 2px solid var(--primary-border);
|
||||
border-radius: 8px;
|
||||
font-weight: 800;
|
||||
width: 32px;
|
||||
padding: 5px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
public RenderFragment ChildContent { get; set; } = default!;
|
||||
|
||||
[Parameter]
|
||||
public string Id { get; set; } = default!;
|
||||
|
||||
private void ButtonClicked(EventArgs eventArgs)
|
||||
{
|
||||
SearchService.Show();
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
@inherits LayoutComponentBase
|
||||
@inject INavigationService navigationService
|
||||
@inject INavigationService NavigationService
|
||||
@implements IDisposable
|
||||
|
||||
@{
|
||||
var visibleStyle = navigationService.GetNavigationSectionId() > 0 ? "clickOffVisible" : "";
|
||||
var visibleStyle = NavigationService.GetNavigationSectionId() > 0 ? "clickOffVisible" : "";
|
||||
}
|
||||
|
||||
<div onclick="@MenuClosed" class="clickOffBackground @visibleStyle">
|
||||
@@ -12,14 +12,14 @@
|
||||
|
||||
<div class="desktopNavContainer">
|
||||
<div class="menuHeader">
|
||||
<NavLink href="/" class="websiteTitle">
|
||||
<NavLink id="desktop-homeLink" href="/" class="websiteTitle">
|
||||
IGP Fan Reference
|
||||
</NavLink>
|
||||
|
||||
<div class="sectionNavs">
|
||||
@foreach (var webSection in WebSections)
|
||||
{
|
||||
var isSelected = navigationService.GetNavigationSectionId().Equals(webSection.Id);
|
||||
var isSelected = NavigationService.GetNavigationSectionId().Equals(webSection.Id);
|
||||
var sectionButtonStyle = "sectionButton";
|
||||
if (isSelected)
|
||||
{
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
<div class="sectionNav">
|
||||
<button onclick="@(() => { MenuClicked(webSection.Id); })" class="@sectionButtonStyle">@webSection.Name</button>
|
||||
|
||||
@if (isSelected)
|
||||
{
|
||||
<div class="navMenuPosition">
|
||||
@@ -41,7 +40,7 @@
|
||||
}
|
||||
</div>
|
||||
|
||||
<SearchButtonComponent/>
|
||||
<SearchButtonComponent Id="desktop-searchButton"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -169,27 +168,27 @@
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
base.OnInitialized();
|
||||
navigationService.Subscribe(StateHasChanged);
|
||||
NavigationService.Subscribe(StateHasChanged);
|
||||
}
|
||||
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
navigationService.Unsubscribe(StateHasChanged);
|
||||
NavigationService.Unsubscribe(StateHasChanged);
|
||||
}
|
||||
|
||||
void MenuClicked(int menuName)
|
||||
{
|
||||
navigationService.ChangeNavigationSectionId(menuName);
|
||||
NavigationService.ChangeNavigationSectionId(menuName);
|
||||
}
|
||||
|
||||
void MenuClosed()
|
||||
{
|
||||
navigationService.ChangeNavigationSectionId(-1);
|
||||
NavigationService.ChangeNavigationSectionId(-1);
|
||||
}
|
||||
|
||||
void HoverOut(MouseEventArgs mouseEventArgs)
|
||||
{
|
||||
navigationService.ChangeNavigationState(NavigationStateType.Default);
|
||||
NavigationService.ChangeNavigationState(NavigationStateType.Default);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,7 @@
|
||||
<div class="mobileFooter">
|
||||
|
||||
|
||||
|
||||
<div class="mobileFooter">
|
||||
<div class="mobileNavSectionsContainer">
|
||||
@foreach (var webSection in WebSections)
|
||||
{
|
||||
@@ -8,6 +11,7 @@
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
<SearchIconButtonComponent/>
|
||||
</div>
|
||||
|
||||
<div class="fullPageButton @(selectedSection != null)" @onclick="OnPageClicked" @onclick:stopPropagation="false" @onclick:preventDefault="false">
|
||||
@@ -52,6 +56,8 @@
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
.mobileFooter {
|
||||
position: fixed;
|
||||
background-color: rgba(0,0,0,1);
|
||||
|
||||
@@ -5,10 +5,13 @@
|
||||
<div class="tabletTitle">
|
||||
IGP Fan Reference
|
||||
</div>
|
||||
|
||||
<div class="tabletButton">
|
||||
<div class="tabletMenuTitle">
|
||||
Menu
|
||||
<div class="tabletButtons">
|
||||
|
||||
<SearchButtonComponent/>
|
||||
<div class="tabletButton">
|
||||
<div class="tabletMenuTitle">
|
||||
Menu
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -78,6 +81,12 @@
|
||||
gap: 22px;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.tabletButtons {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
|
||||
.tabletNavItem {
|
||||
padding: 8px;
|
||||
|
||||
Reference in New Issue
Block a user