Skip to content

Commit

Permalink
First Add Search Bar Component
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanValadezCastaneda committed Apr 25, 2024
1 parent 9547324 commit 2506486
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Pages/SearchPage.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@page
@model WinCCOAOutsideInfoRepo.Pages.SearchPageModel
@{
ViewData["Title"] = "Search";
}

<form method="get" action="/search-results">
<input type="text" name="query" placeholder="Search..." />
<button type="submit">Search</button>
</form>
12 changes: 12 additions & 0 deletions Pages/SearchPage.cshtml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace WinCCOAOutsideInfoRepo.Pages
{
public class SearchPageModel : PageModel
{
public void OnGet()
{
}
}
}
17 changes: 17 additions & 0 deletions Pages/Shared/SearchBarComponent.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<h3>SearchBarComponent</h3>

@code {
[Parameter] public EventCallback<string> OnSearch { get; set; }

private string searchText;

private void TriggerSearch()
{
OnSearch.InvokeAsync(searchText);
}
}

<form @onsubmit="TriggerSearch" role="search">
<input type="text" @bind="searchText" placeholder="Searching" />
<button type="submit">Search</button>
</form>

0 comments on commit 2506486

Please sign in to comment.