diff --git a/pages/interface/components/SearchBox/index.js b/pages/interface/components/SearchBox/index.js index 37389401a..fef52949d 100644 --- a/pages/interface/components/SearchBox/index.js +++ b/pages/interface/components/SearchBox/index.js @@ -293,6 +293,8 @@ export default function useSearchBox() { } function SearchBoxMainSuggestions({ sx, ...props }) { + const showNoSuggestionsMessage = !isSuggestionsLoading && (!searchTrends || searchTrends.results?.length === 0); + return ( {isSuggestionsLoading ? ( @@ -303,144 +305,20 @@ export default function useSearchBox() { {searchTrends.results.map((x) => ( - a': { - color: 'fg.default', - }, - borderRadius: 2, - }} - key={x.id}> - - - - - - - {x.search_term} - - {x.search_count >= 20 && ( - - - - )} - - + ))} - ) : valueSearchEnd && !searchTrends.results?.length > 0 ? ( + ) : valueSearchEnd && showNoSuggestionsMessage ? ( - a': { - color: 'fg.default', - }, - borderRadius: 2, - }}> - - - - - - Nenhuma sugestão, seja o primeiro! - - - - - - + - ) : ( + ) : null} + {!valueSearchEnd && showNoSuggestionsMessage && ( Quando eu cheguei era tudo mato... @@ -449,6 +327,125 @@ export default function useSearchBox() { ); } + function SearchResultItem({ x }) { + return ( + a': { + color: 'fg.default', + }, + borderRadius: 2, + }}> + + + + + + {x.search_term} + + {x.search_count >= 20 && ( + + + + )} + + + ); + } + + function NoSuggestionsLink() { + return ( + + + + + + Nenhuma sugestão, seja o primeiro! + + + + + + ); + } + function SearchIconButton({ sx, ...props }) { return (