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:
parent
11fae604be
commit
d0f133acda
2 changed files with 8 additions and 2 deletions
|
@ -26,6 +26,7 @@ function ItemSearchPage() {
|
||||||
showItemsLabel
|
showItemsLabel
|
||||||
background={brightBackground}
|
background={brightBackground}
|
||||||
boxShadow="md"
|
boxShadow="md"
|
||||||
|
autoFocus
|
||||||
/>
|
/>
|
||||||
<Box height="6" />
|
<Box height="6" />
|
||||||
<ItemSearchPageResults query={query} />
|
<ItemSearchPageResults query={query} />
|
||||||
|
|
|
@ -42,6 +42,7 @@ function SearchToolbar({
|
||||||
searchQueryRef,
|
searchQueryRef,
|
||||||
firstSearchResultRef,
|
firstSearchResultRef,
|
||||||
onChange,
|
onChange,
|
||||||
|
autoFocus,
|
||||||
showItemsLabel = false,
|
showItemsLabel = false,
|
||||||
background = null,
|
background = null,
|
||||||
boxShadow = null,
|
boxShadow = null,
|
||||||
|
@ -188,8 +189,12 @@ function SearchToolbar({
|
||||||
<SearchIcon color="gray.400" />
|
<SearchIcon color="gray.400" />
|
||||||
</InputLeftElement>
|
</InputLeftElement>
|
||||||
)}
|
)}
|
||||||
<Input background={background} {...inputProps} />
|
<Input
|
||||||
{(query.value || queryFilterText) && (
|
background={background}
|
||||||
|
autoFocus={autoFocus}
|
||||||
|
{...inputProps}
|
||||||
|
/>
|
||||||
|
{!searchQueryIsEmpty(query) && (
|
||||||
<InputRightElement>
|
<InputRightElement>
|
||||||
<IconButton
|
<IconButton
|
||||||
icon={<CloseIcon />}
|
icon={<CloseIcon />}
|
||||||
|
|
Loading…
Reference in a new issue