WIP Tooltip code
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
@implements IDisposable;
|
||||
@inject ISearchService searchService
|
||||
@inject IJSRuntime jsRuntime
|
||||
@inject ISearchService SearchService
|
||||
@inject IJSRuntime JsRuntime
|
||||
|
||||
|
||||
@inject NavigationManager navigationManager
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
@if (searchService.IsLoaded() && searchService.IsVisible)
|
||||
@if (SearchService.IsLoaded() && SearchService.IsVisible)
|
||||
{
|
||||
<div id="searchBackground" class="searchBackground" onclick="@CloseDialog">
|
||||
<div class="searchContainer"
|
||||
@@ -20,7 +20,7 @@
|
||||
<div class="searchBox">
|
||||
@if (SearchText.Length > 0)
|
||||
{
|
||||
foreach (var searchSection in searchService.Searches)
|
||||
foreach (var searchSection in SearchService.Searches)
|
||||
{
|
||||
var searchPoints = searchSection.Value.FindAll(x => x.Title.ToLower().Contains(SearchText.ToLower()));
|
||||
|
||||
@@ -141,7 +141,7 @@
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
searchService.Subscribe(OnSearchChanged);
|
||||
SearchService.Subscribe(OnSearchChanged);
|
||||
|
||||
timer = new Timer(200);
|
||||
timer.Elapsed += FocusTimer;
|
||||
@@ -151,7 +151,7 @@
|
||||
|
||||
private void FocusTimer(object? sender, ElapsedEventArgs e)
|
||||
{
|
||||
jsRuntime.InvokeVoidAsync("SetFocusToElement", "searchInput");
|
||||
JsRuntime.InvokeVoidAsync("SetFocusToElement", "searchInput");
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
@@ -159,9 +159,9 @@
|
||||
|
||||
private void OnSearchChanged()
|
||||
{
|
||||
if (timer.Enabled != searchService.IsVisible)
|
||||
if (timer.Enabled != SearchService.IsVisible)
|
||||
{
|
||||
timer.Enabled = searchService.IsVisible;
|
||||
timer.Enabled = SearchService.IsVisible;
|
||||
}
|
||||
|
||||
StateHasChanged();
|
||||
@@ -169,26 +169,26 @@
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
searchService.Unsubscribe(OnSearchChanged);
|
||||
SearchService.Unsubscribe(OnSearchChanged);
|
||||
timer.Elapsed -= FocusTimer;
|
||||
}
|
||||
|
||||
|
||||
public void CloseDialog()
|
||||
{
|
||||
searchService.Hide();
|
||||
SearchService.Hide();
|
||||
}
|
||||
|
||||
public void NavigateTo(string url)
|
||||
{
|
||||
if (url.Contains("#"))
|
||||
{
|
||||
navigationManager.NavigateTo(url,
|
||||
navigationManager.Uri.Split("#").First().Contains(url.Split("#").First()));
|
||||
NavigationManager.NavigateTo(url,
|
||||
NavigationManager.Uri.Split("#").First().Contains(url.Split("#").First()));
|
||||
}
|
||||
else
|
||||
{
|
||||
navigationManager.NavigateTo(url);
|
||||
NavigationManager.NavigateTo(url);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@
|
||||
private void OnSearch(SearchPointModel searchPoint)
|
||||
{
|
||||
NavigateTo(searchPoint.Href);
|
||||
searchService.Hide();
|
||||
SearchService.Hide();
|
||||
}
|
||||
|
||||
private void OnFocus(object obj)
|
||||
|
||||
Reference in New Issue
Block a user