Skip to content

Instantly share code, notes, and snippets.

@Mirch Mirch/MainLayout.cs
Created Dec 28, 2018

Embed
What would you like to do?
@inherits BlazorLayoutComponent
@inject Microsoft.AspNetCore.Blazor.Services.IUriHelper UriHelper
<div class="sidebar">
<NavMenu />
</div>
<div class="main">
<div class="top-row px-4">
<input type="search" bind-value-oninput="@SearchTerm" onkeydown="@((e) => SearchKeyDown(e))" placeholder="Search..." />
</div>
<div class="content px-4">
@Body
</div>
</div>
@functions {
private string SearchTerm { get; set; }
private void SearchKeyDown(UIKeyboardEventArgs e)
{
if (e.Key == "Enter")
{
this.StateHasChanged();
UriHelper.NavigateTo($"/search/{SearchTerm}");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.