Skip to content

Commit

Permalink
fix: show a loading message while waiting for a response
Browse files Browse the repository at this point in the history
Signed-off-by: Andreea-Lupu <[email protected]>
  • Loading branch information
Andreea-Lupu committed Dec 11, 2023
1 parent d9370fb commit 7fa6648
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/components/Header/SearchSuggestion.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -295,12 +295,27 @@ function SearchSuggestion({ setSearchCurrentValue = () => {} }) {
<List
{...getMenuProps()}
className={
isOpen && !isLoading && !isFailedSearch
isOpen && !isFailedSearch
? `${classes.resultsWrapper} ${isComponentFocused && classes.resultsWrapperFocused}`
: classes.resultsWrapperHidden
}
>
{isOpen && suggestionData?.length > 0 && renderSuggestions()}
{isOpen && isLoading && !isEmpty(searchQuery) && isEmpty(suggestionData) && (
<>
<ListItem
className={classes.searchItem}
style={{ color: '#52637A', fontSize: '1rem', textOverflow: 'ellipsis' }}
{...getItemProps({ item: '', index: 0 })}
spacing={2}
onClick={() => {}}

Check warning on line 311 in src/components/Header/SearchSuggestion.jsx

View check run for this annotation

Codecov / codecov/patch

src/components/Header/SearchSuggestion.jsx#L311

Added line #L311 was not covered by tests
>
<Stack direction="row" spacing={2}>
<Typography>Loading...</Typography>
</Stack>
</ListItem>
</>
)}
{isOpen && isEmpty(searchQuery) && isEmpty(suggestionData) && (
<>
<ListItem
Expand Down

0 comments on commit 7fa6648

Please sign in to comment.