diff --git a/BlazorWebAssemblyXrefGenerator/Pages/Home.razor b/BlazorWebAssemblyXrefGenerator/Pages/Home.razor index db148233..0087d066 100644 --- a/BlazorWebAssemblyXrefGenerator/Pages/Home.razor +++ b/BlazorWebAssemblyXrefGenerator/Pages/Home.razor @@ -3,24 +3,33 @@ @using System.Text.RegularExpressions @inject IHttpClientFactory ClientFactory -
-

Namespace/Member

- - - -
- -

Links

+ +
+
+

Search

+
+
+
+

Provide a namespace, class, member, or /dotnet/api/... relative link.

+ +
+
+ + +
+
+
+
@if (SearchResultItems?.Results?.Count() > 0) { -
    +
      @foreach (var result in SearchResultItems.Results.Select((x, i) => new { Data = x, Index = i })) {
    1. @result.Data.DisplayName
      Item Type: @result.Data.ItemType
      -
      Description: @result.Data.Description
      +
      Description: @result.Data.Description
      @@ -41,21 +50,25 @@ @message @code { - private string? searchText; + [SupplyParameterFromForm] + private FormModel? Model { get; set; } + private SearchResults? SearchResultItems { get; set; } public string? message; + protected override void OnInitialized() => Model ??= new(); + public async Task GetSearchResults() { message = string.Empty; var apiClient = ClientFactory.CreateClient("APIClient"); - if (string.IsNullOrEmpty(searchText) || apiClient == null) + if (string.IsNullOrEmpty(Model?.SearchText) || apiClient == null) { return; } - SearchResultItems = await apiClient.GetFromJsonAsync($"api/apibrowser/dotnet/search?api-version=0.2&search={searchText}"); + SearchResultItems = await apiClient.GetFromJsonAsync($"api/apibrowser/dotnet/search?api-version=0.2&search={Model.SearchText}"); if (SearchResultItems?.Results != null) { @@ -79,9 +92,14 @@ message = "Request failed."; } - searchText = string.Empty; + Model.SearchText = string.Empty; - StateHasChanged(); + //StateHasChanged(); + } + + public class FormModel + { + public string? SearchText { get; set; } = string.Empty; } public class SearchResults diff --git a/BlazorWebAssemblyXrefGenerator/wwwroot/css/app.css b/BlazorWebAssemblyXrefGenerator/wwwroot/css/app.css index 5e8941c4..2e0b15ce 100644 --- a/BlazorWebAssemblyXrefGenerator/wwwroot/css/app.css +++ b/BlazorWebAssemblyXrefGenerator/wwwroot/css/app.css @@ -16,7 +16,7 @@ a, .btn-link { input { margin-bottom: 5px; - width: 100% + width: 90% } .btn-primary {