From d0f133acda69f3b65f30bedd347e5512986d8616 Mon Sep 17 00:00:00 2001 From: Matchu Date: Thu, 21 Jan 2021 16:38:08 -0800 Subject: [PATCH] Stop showing clear on item search page when empty Oops, the old condition depending on `queryFilterText` to implicitly check for filter presence. But now that we always show "Items" as prefix text for the filters on this page, the reset button was always showing! Use our new util function instead. --- src/app/ItemSearchPage.js | 1 + src/app/WardrobePage/SearchToolbar.js | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/app/ItemSearchPage.js b/src/app/ItemSearchPage.js index e4a9e96..6025ea2 100644 --- a/src/app/ItemSearchPage.js +++ b/src/app/ItemSearchPage.js @@ -26,6 +26,7 @@ function ItemSearchPage() { showItemsLabel background={brightBackground} boxShadow="md" + autoFocus /> diff --git a/src/app/WardrobePage/SearchToolbar.js b/src/app/WardrobePage/SearchToolbar.js index b33d461..8571eba 100644 --- a/src/app/WardrobePage/SearchToolbar.js +++ b/src/app/WardrobePage/SearchToolbar.js @@ -42,6 +42,7 @@ function SearchToolbar({ searchQueryRef, firstSearchResultRef, onChange, + autoFocus, showItemsLabel = false, background = null, boxShadow = null, @@ -188,8 +189,12 @@ function SearchToolbar({ )} - - {(query.value || queryFilterText) && ( + + {!searchQueryIsEmpty(query) && ( }