From e096af320f0a790955ab9780245b7f17b3648b43 Mon Sep 17 00:00:00 2001 From: sbwalker Date: Tue, 27 Aug 2024 12:16:36 -0400 Subject: [PATCH] provide better support for AllowTextInput on Search component --- .../Themes/Controls/Theme/Search.razor | 29 +++++++------------ Oqtane.Server/wwwroot/css/app.css | 19 ++++++++++-- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/Oqtane.Client/Themes/Controls/Theme/Search.razor b/Oqtane.Client/Themes/Controls/Theme/Search.razor index 4b04dafe0..26210b31b 100644 --- a/Oqtane.Client/Themes/Controls/Theme/Search.razor +++ b/Oqtane.Client/Themes/Controls/Theme/Search.razor @@ -8,34 +8,26 @@ @if (_searchResultsPage != null) { - @if (AllowTextInput) - { - -
- + + + + @if (AllowTextInput) + { - - -
- } - else - { -
- -
- } +
} @code { + private string _defaultCssClass; private Page _searchResultsPage; private string _keywords = ""; @@ -43,7 +35,7 @@ public string CssClass { get; set; } [Parameter] - public bool AllowTextInput { get; set; } = true; // setting to false will display only the search icon button - not the textbox + public bool AllowTextInput { get; set; } = true; // setting to false will display only the search icon button - not the textbox [Parameter] public string SearchResultPagePath { get; set; } = "search"; // setting to "" will disable search @@ -58,6 +50,7 @@ { if (bool.Parse(SettingService.GetSetting(PageState.Site.Settings, "Search_Enabled", "True"))) { + _defaultCssClass = (AllowTextInput) ? "app-search" : "app-search-noinput"; if (!string.IsNullOrEmpty(SearchResultPagePath)) { _searchResultsPage = PageState.Pages.FirstOrDefault(i => i.Path == SearchResultPagePath); diff --git a/Oqtane.Server/wwwroot/css/app.css b/Oqtane.Server/wwwroot/css/app.css index a55abaeb0..b7143eae9 100644 --- a/Oqtane.Server/wwwroot/css/app.css +++ b/Oqtane.Server/wwwroot/css/app.css @@ -235,20 +235,33 @@ app { .app-form-inline { display: inline; } -.app-search{ + +.app-search { display: inline-block; position: relative; } -.app-search input + button{ +.app-search input + button { background: none; border: none; position: absolute; right: 0; top: 0; } -.app-search input + button .oi{ +.app-search input + button .oi { top: 0; } +.app-search-noinput { + display: inline-block; + position: relative; +} +.app-search-noinput button { + background: none; + border: none; + color: var(--bs-heading-color); +} +.app-search-noinput button:hover { + color: var(--bs-heading-color); +} /* Text Editor */ .text-area-editor > textarea {