@using MudBlazor
@namespace OpenArchival.Blazor.ArchiveDisplay

<Microsoft.AspNetCore.Components.Forms.EditForm Model="this" OnSubmit="OnSubmit">
<MudTextField FullWidth="true"
              AutoFocus="string.IsNullOrEmpty(SearchTerms)"
              Placeholder="Search"
              T="string"
              Variant="Variant.Outlined"
              Adornment="Adornment.Start"
              AdornmentIcon="@Icons.Material.Filled.Search"
              Class="mt-5"
              @bind-Value="SearchTerms"
               />

</Microsoft.AspNetCore.Components.Forms.EditForm>
@code {
    [Parameter]
    public string SearchTerms { get; set; } = "";

    [Parameter]
    public EventCallback<string> SearchTermsChanged { get; set; }

    private async Task HandleSearchKeyDown(Microsoft.AspNetCore.Components.Web.KeyboardEventArgs args)
    {
        if (args.Key == "Enter")
        {
            await SearchTermsChanged.InvokeAsync(SearchTerms);
        }
    }
    private async Task OnSubmit(Microsoft.AspNetCore.Components.Forms.EditContext args)
    {
        await SearchTermsChanged.InvokeAsync(SearchTerms);
    }
}