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.
This commit is contained in:
Emi Matchu 2021-01-21 16:38:08 -08:00
parent 11fae604be
commit d0f133acda
2 changed files with 8 additions and 2 deletions

View file

@ -26,6 +26,7 @@ function ItemSearchPage() {
showItemsLabel
background={brightBackground}
boxShadow="md"
autoFocus
/>
<Box height="6" />
<ItemSearchPageResults query={query} />

View file

@ -42,6 +42,7 @@ function SearchToolbar({
searchQueryRef,
firstSearchResultRef,
onChange,
autoFocus,
showItemsLabel = false,
background = null,
boxShadow = null,
@ -188,8 +189,12 @@ function SearchToolbar({
<SearchIcon color="gray.400" />
</InputLeftElement>
)}
<Input background={background} {...inputProps} />
{(query.value || queryFilterText) && (
<Input
background={background}
autoFocus={autoFocus}
{...inputProps}
/>
{!searchQueryIsEmpty(query) && (
<InputRightElement>
<IconButton
icon={<CloseIcon />}