diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Filter/AdvancedGameFilter.razor.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Filter/AdvancedGameFilter.razor.cs index b0ae8c2..50cd8ef 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Filter/AdvancedGameFilter.razor.cs +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Pages/Games/Filter/AdvancedGameFilter.razor.cs @@ -49,17 +49,15 @@ public partial class AdvancedGameFilter throw new ArgumentNullException(ResourcesKey.ErrorStorageSpaceLabel); } - private async Task HandleExpandFilterAsync(Microsoft.AspNetCore.Components.Web.MouseEventArgs args) + private void HandleExpandFilterAsync(Microsoft.AspNetCore.Components.Web.MouseEventArgs args) { ExpandedFilter = true; - await ExpandedFilterChanged.InvokeAsync(ExpandedFilter); BackdropFilter?.Show(); } - private async Task HandleBackdropFilterClickedAsync() + private void HandleBackdropFilterClickedAsync() { ExpandedFilter = false; - await ExpandedFilterChanged.InvokeAsync(ExpandedFilter); } private void HandleLocationChanged(LocationChangingContext locationContext) diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Search/SearchInput.razor.css b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Search/SearchInput.razor.css index c4df4e5..4ccc405 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Search/SearchInput.razor.css +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Search/SearchInput.razor.css @@ -26,7 +26,7 @@ height: 100%; width: 100%; padding: 0; - min-width: 0; + min-width: 0; } .clear-icon { @@ -34,7 +34,7 @@ min-width: 18px; height: 18px; width: 18px; - z-index: var(--index-overlay); + z-index: 800; } .clear-icon:hover { diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/SelectSearch/SelectSearch.razor b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/SelectSearch/SelectSearch.razor index 4989c12..9184918 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/SelectSearch/SelectSearch.razor +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/SelectSearch/SelectSearch.razor @@ -10,7 +10,7 @@
diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/SelectSearch/SelectSearch.razor.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/SelectSearch/SelectSearch.razor.cs index f38bff9..4e78122 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/SelectSearch/SelectSearch.razor.cs +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/SelectSearch/SelectSearch.razor.cs @@ -1,3 +1,4 @@ +using GameIdeas.BlazorApp.Pages.Games; using GameIdeas.BlazorApp.Shared.Components.Search; using GameIdeas.BlazorApp.Shared.Components.Select; using GameIdeas.BlazorApp.Shared.Components.Select.Models; @@ -61,4 +62,23 @@ public partial class SelectSearch { Select?.Open(); } + private void HandleTextChanged(string args) + { + if (!string.IsNullOrEmpty(args)) + { + var keywords = args + .Split([' '], StringSplitOptions.RemoveEmptyEntries) + .Select(k => k.Trim()) + .ToArray() ?? []; + + SelectParams.Items = [.. Items + .Where(game => keywords.All( + kw => SelectParams.GetItemLabel(game).Contains(kw, StringComparison.OrdinalIgnoreCase) + )) + .OrderBy(game => keywords.Min(kw => + SelectParams.GetItemLabel(game).IndexOf(kw, StringComparison.OrdinalIgnoreCase) + )) + .ThenBy(game => SelectParams.GetItemLabel(game).Length)]; + } + } } \ No newline at end of file