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.
59 lines
1.3 KiB
59 lines
1.3 KiB
@inject ISearchService SearchService |
|
@inject NavigationManager NavigationManager |
|
@inject IJSRuntime JsRuntime |
|
|
|
<button class="searchButtonContainer" @onclick="ButtonClicked"> |
|
<div class="searchText"> |
|
Search... |
|
</div> |
|
<div class="searchHotkey"> |
|
@CommandKey + K |
|
</div> |
|
</button> |
|
|
|
<style> |
|
.searchButtonContainer { |
|
background-color: var(--primary); |
|
border: 2px solid var(--primary-border); |
|
border-radius: 8px; |
|
font-weight: 800; |
|
width: 350px; |
|
|
|
padding: 5px; |
|
display: flex; |
|
flex-direction: row; |
|
justify-content: space-between; |
|
align-items: center; |
|
|
|
} |
|
|
|
.searchHotkey { |
|
padding: 2px; |
|
|
|
background-color: var(--info); |
|
border: 2px solid var(--primary-border); |
|
} |
|
|
|
</style> |
|
|
|
|
|
@code { |
|
|
|
[Parameter] |
|
public RenderFragment ChildContent { get; set; } = default!; |
|
|
|
private string userAgent = ""; |
|
|
|
string CommandKey => userAgent.Contains("Mac OS") ? "CMD" : "Ctrl"; |
|
|
|
private void ButtonClicked(EventArgs eventArgs) |
|
{ |
|
SearchService.Show(); |
|
} |
|
|
|
protected override async Task OnInitializedAsync() |
|
{ |
|
userAgent = await JsRuntime.InvokeAsync<string>("getUserAgent"); |
|
} |
|
|
|
} |