diff --git a/WatchIt.Common/WatchIt.Common.Query/QueryParameters.cs b/WatchIt.Common/WatchIt.Common.Query/QueryParameters.cs index 685da26..7934cdc 100644 --- a/WatchIt.Common/WatchIt.Common.Query/QueryParameters.cs +++ b/WatchIt.Common/WatchIt.Common.Query/QueryParameters.cs @@ -66,7 +66,7 @@ public abstract class QueryParameters ( !string.IsNullOrEmpty(property) && - new Regex(regexQuery).IsMatch(property) + Regex.IsMatch(property, regexQuery, RegexOptions.IgnoreCase) ) ); diff --git a/WatchIt.Website/WatchIt.Website/App.razor b/WatchIt.Website/WatchIt.Website/App.razor index 4492067..35cf53c 100644 --- a/WatchIt.Website/WatchIt.Website/App.razor +++ b/WatchIt.Website/WatchIt.Website/App.razor @@ -11,7 +11,7 @@ - + diff --git a/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor b/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor index bacd53c..7473c33 100644 --- a/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor +++ b/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor @@ -20,7 +20,23 @@
- menu +
+ @if (_searchbarVisible) + { +
+ +
+ + + cancel_icon + + } + else + { + + + } +
diff --git a/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor.cs b/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor.cs index 941eb4f..db6a271 100644 --- a/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor.cs +++ b/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor.cs @@ -1,3 +1,4 @@ +using System.Net; using Microsoft.AspNetCore.Components; using WatchIt.Common.Model.Accounts; using WatchIt.Common.Model.Photos; @@ -33,6 +34,9 @@ public partial class MainLayout : LayoutComponentBase private PhotoResponse? _defaultBackgroundPhoto; private AccountProfilePictureResponse? _userProfilePicture; + private bool _searchbarVisible; + private string _searchbarText = string.Empty; + #endregion @@ -108,6 +112,19 @@ public partial class MainLayout : LayoutComponentBase #endregion + #region Search + + private void SearchStart() + { + if (!string.IsNullOrWhiteSpace(_searchbarText)) + { + string query = WebUtility.UrlEncode(_searchbarText); + NavigationManager.NavigateTo($"/search/{query}"); + } + } + + #endregion + #region User menu private async Task UserMenuLogOut() diff --git a/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor.css b/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor.css index 443c860..9a467a1 100644 --- a/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor.css +++ b/WatchIt.Website/WatchIt.Website/Layout/MainLayout.razor.css @@ -10,4 +10,9 @@ h1 { #logo { font-size: 40px; +} + +#searchbarCancel { + cursor: pointer; + color: #6c757d; } \ No newline at end of file diff --git a/WatchIt.Website/WatchIt.Website/wwwroot/assets/icons/cancel.png b/WatchIt.Website/WatchIt.Website/wwwroot/assets/icons/cancel.png new file mode 100644 index 0000000..68a9cba Binary files /dev/null and b/WatchIt.Website/WatchIt.Website/wwwroot/assets/icons/cancel.png differ