Skip to content

Instantly share code, notes, and snippets.

@Mirch
Created December 28, 2018 13:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mirch/2d621490b8988589e1690340f11284f0 to your computer and use it in GitHub Desktop.
Save Mirch/2d621490b8988589e1690340f11284f0 to your computer and use it in GitHub Desktop.
@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