diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Layouts/Header/LoginValidator.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Account/LoginValidator.cs similarity index 85% rename from src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Layouts/Header/LoginValidator.cs rename to src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Account/LoginValidator.cs index 14cd426..629c3c9 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Layouts/Header/LoginValidator.cs +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Account/LoginValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; using GameIdeas.Shared.Dto; -namespace GameIdeas.BlazorApp.Shared.Layouts.Header; +namespace GameIdeas.BlazorApp.Shared.Components.Account; public class LoginValidator : AbstractValidator { diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Search/SearchInput.razor b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Search/SearchInput.razor index a83c92f..50b36d0 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Search/SearchInput.razor +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Search/SearchInput.razor @@ -1,16 +1,27 @@ 
+ @bind-Value=Text /> + + @if (!string.IsNullOrEmpty(Text)) + { +
+ + + +
+ } -
- - - -
- + @if (Icon == SearchInputIcon.Search) + { + + } + else if (Icon == SearchInputIcon.Dropdown) + { + + }
diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Search/SearchInput.razor.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Search/SearchInput.razor.cs index 976b70b..d9e601f 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Search/SearchInput.razor.cs +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Search/SearchInput.razor.cs @@ -8,6 +8,7 @@ public partial class SearchInput { [Parameter] public string? Text { get; set; } [Parameter] public EventCallback TextChanged { get; set; } + [Parameter] public SearchInputIcon Icon { get; set; } private EditContext? EditContext; diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Search/SearchInputIcon.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Search/SearchInputIcon.cs new file mode 100644 index 0000000..3f731f2 --- /dev/null +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Search/SearchInputIcon.cs @@ -0,0 +1,7 @@ +namespace GameIdeas.BlazorApp.Shared.Components.Search; + +public enum SearchInputIcon +{ + Search, + Dropdown +} diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/Components/SelectListElement.razor.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/Components/SelectListElement.razor.cs index c33f01a..c37d70b 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/Components/SelectListElement.razor.cs +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/Components/SelectListElement.razor.cs @@ -11,7 +11,6 @@ public partial class SelectListElement { if (Value != null) { - Value.IsSelected = true; await ValueChanged.InvokeAsync(Value); } } diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/Components/SelectListElement.razor.css b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/Components/SelectListElement.razor.css index 38ad19b..792c973 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/Components/SelectListElement.razor.css +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/Components/SelectListElement.razor.css @@ -1,19 +1,32 @@ .select-element { + display: flex; + flex-direction: row; width: fit-content; + width: 100%; + gap: 6px; + height: 20px; + align-items: center; } .select-element:hover { cursor: pointer; } +.selected { + width: 12px; + min-width: 12px; + height: 12px; + min-height: 12px; +} + .selected svg { + display: block; fill: var(--white) } /***** Navigation Theme *****/ .navigation { padding: 4px 8px; - width: 100%; } .navigation .selected { @@ -26,10 +39,6 @@ /***** Sort Theme *****/ .sort { - gap: 6px; - display: flex; - flex-direction: row; - width: 100%; padding: 2px 6px; } @@ -37,11 +46,6 @@ background: var(--low-white); } -.sort .selected { - width: 20px; - height: 20px; -} - .sort .select-label { text-wrap: nowrap; margin-right: 6px; diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/MultipleSelectList.razor b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/MultipleSelectList.razor new file mode 100644 index 0000000..05e534f --- /dev/null +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/MultipleSelectList.razor @@ -0,0 +1,29 @@ +@using GameIdeas.BlazorApp.Shared.Components.Search +@using GameIdeas.BlazorApp.Shared.Components.Select.Components +@typeparam TItem + +
+
+ +
+
+ + @if (ContentVisile) + { +
+ @foreach (var item in Items) + { + + } +
+ } +
+
+ diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/MultipleSelectList.razor.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/MultipleSelectList.razor.cs new file mode 100644 index 0000000..727513b --- /dev/null +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/MultipleSelectList.razor.cs @@ -0,0 +1,51 @@ +using Microsoft.AspNetCore.Components; + +namespace GameIdeas.BlazorApp.Shared.Components.Select; + +public partial class MultipleSelectList +{ + [Parameter] public IEnumerable? Values { get; set; } + [Parameter] public EventCallback?> ValuesChanged { get; set; } + [Parameter] public IEnumerable> Items { get; set; } = []; + [Parameter] public SelectListTheme Theme { get; set; } + [Parameter] public bool AlignRight { get; set; } + + private bool ContentVisile = false; + private DateTime ContentLastFocusOut = DateTime.Now; + private ElementReference Container; + private string? Text; + + public async Task OpenAsync() + { + if (DateTime.Now - ContentLastFocusOut >= TimeSpan.FromSeconds(0.2)) + { + await Container.FocusAsync(); + ContentVisile = true; + } + } + + public void Close() => ContentVisile = false; + + private async Task HandleButtonClicked() => await OpenAsync(); + + private void HandleFocusOut() + { + ContentLastFocusOut = DateTime.Now; + ContentVisile = true; + } + + private async Task HandleItemClicked(SelectElement selectedValue) + { + selectedValue.IsSelected = !selectedValue.IsSelected; + Values = Items.Where(x => x.IsSelected && x.Item != null).Select(x => x.Item!); + Text = string.Join(", ", Values); + await ValuesChanged.InvokeAsync(Values); + } + private void HandleTextChanged(string args) + { + foreach (var item in Items) + { + item.IsSelected = false; + } + } +} \ No newline at end of file diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/MultipleSelectList.razor.css b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/MultipleSelectList.razor.css new file mode 100644 index 0000000..3c7930d --- /dev/null +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/MultipleSelectList.razor.css @@ -0,0 +1 @@ +@import "SelectList.razor.css"; diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/SelectElement.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/SelectElement.cs index b6a9299..6815c78 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/SelectElement.cs +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/SelectElement.cs @@ -5,4 +5,5 @@ public class SelectElement public TItem? Item { get; set; } public string? Label { get; set; } public bool IsSelected { get; set; } = false; + public bool IsNew { get; set; } = false; } diff --git a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/SelectList.razor.cs b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/SelectList.razor.cs index e8cca12..13e6254 100644 --- a/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/SelectList.razor.cs +++ b/src/GameIdeas/Client/GameIdeas.BlazorApp/Shared/Components/Select/SelectList.razor.cs @@ -34,7 +34,7 @@ public partial class SelectList private void HandleFocusOut() { ContentLastFocusOut = DateTime.Now; - ContentVisile = false; + ContentVisile = true; } private async Task HandleItemClicked(SelectElement selectedValue)