Commit bc0d69ae authored by tom's avatar tom

tweaks

parent 0c1fa3f7
...@@ -18,7 +18,7 @@ import SearchBarInput from 'ui/snippets/searchBar/SearchBarInput'; ...@@ -18,7 +18,7 @@ import SearchBarInput from 'ui/snippets/searchBar/SearchBarInput';
import useSearchQuery from 'ui/snippets/searchBar/useSearchQuery'; import useSearchQuery from 'ui/snippets/searchBar/useSearchQuery';
const SearchResultsPageContent = () => { const SearchResultsPageContent = () => {
const { query, searchTerm, handleSearchTermChange } = useSearchQuery(true); const { query, searchTerm, debouncedSearchTerm, handleSearchTermChange } = useSearchQuery(true);
const { data, isError, isLoading, pagination, isPaginationVisible } = query; const { data, isError, isLoading, pagination, isPaginationVisible } = query;
const handleSubmit = React.useCallback((event: FormEvent<HTMLFormElement>) => { const handleSubmit = React.useCallback((event: FormEvent<HTMLFormElement>) => {
...@@ -54,7 +54,7 @@ const SearchResultsPageContent = () => { ...@@ -54,7 +54,7 @@ const SearchResultsPageContent = () => {
<span>Found </span> <span>Found </span>
<chakra.span fontWeight={ 700 }>{ num }{ data.next_page_params || pagination.page > 1 ? '+' : '' }</chakra.span> <chakra.span fontWeight={ 700 }>{ num }{ data.next_page_params || pagination.page > 1 ? '+' : '' }</chakra.span>
<span> matching results for </span> <span> matching results for </span>
<chakra.span fontWeight={ 700 }>{ searchTerm }</chakra.span> <chakra.span fontWeight={ 700 }>{ debouncedSearchTerm }</chakra.span>
</Box> </Box>
); );
...@@ -80,7 +80,7 @@ const SearchResultsPageContent = () => { ...@@ -80,7 +80,7 @@ const SearchResultsPageContent = () => {
{ data.items.length > 0 && ( { data.items.length > 0 && (
<> <>
<Show below="lg" ssr={ false }> <Show below="lg" ssr={ false }>
{ data.items.map((item, index) => <SearchResultListItem key={ index } data={ item } searchTerm={ searchTerm }/>) } { data.items.map((item, index) => <SearchResultListItem key={ index } data={ item } searchTerm={ debouncedSearchTerm }/>) }
</Show> </Show>
<Hide below="lg" ssr={ false }> <Hide below="lg" ssr={ false }>
<Table variant="simple" size="md" fontWeight={ 500 }> <Table variant="simple" size="md" fontWeight={ 500 }>
...@@ -92,7 +92,7 @@ const SearchResultsPageContent = () => { ...@@ -92,7 +92,7 @@ const SearchResultsPageContent = () => {
</Tr> </Tr>
</Thead> </Thead>
<Tbody> <Tbody>
{ data.items.map((item, index) => <SearchResultTableItem key={ index } data={ item } searchTerm={ searchTerm }/>) } { data.items.map((item, index) => <SearchResultTableItem key={ index } data={ item } searchTerm={ debouncedSearchTerm }/>) }
</Tbody> </Tbody>
</Table> </Table>
</Hide> </Hide>
......
...@@ -62,6 +62,7 @@ const SearchBar = ({ isHomepage, withShadow }: Props) => { ...@@ -62,6 +62,7 @@ const SearchBar = ({ isHomepage, withShadow }: Props) => {
onClose={ onClose } onClose={ onClose }
placement="bottom-start" placement="bottom-start"
offset={ isMobile && !isHomepage ? [ 16, -12 ] : undefined } offset={ isMobile && !isHomepage ? [ 16, -12 ] : undefined }
isLazy
> >
<PopoverTrigger> <PopoverTrigger>
<SearchBarInput <SearchBarInput
......
...@@ -76,6 +76,7 @@ export default function useSearchQuery(isSearchPage = false) { ...@@ -76,6 +76,7 @@ export default function useSearchQuery(isSearchPage = false) {
return { return {
searchTerm, searchTerm,
debouncedSearchTerm,
handleSearchTermChange, handleSearchTermChange,
query, query,
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment