Skip to content

Commit

Permalink
Correct group view when cards are shown in search results
Browse files Browse the repository at this point in the history
  • Loading branch information
katarinazaprazna committed Jul 2, 2024
1 parent fb5bd20 commit 7d16d8a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion next/components/sections/SearchSection/SearchResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ const SearchResults = ({
const { searchResultsData, searchResultsCount } = data ?? { searchResultsCount: 0 }

const GENERAL_RESULTS_COUNT = 5
const RESULTS_COUNT =
(searchResultsData?.length as number) < 5 ? searchResultsData?.length : GENERAL_RESULTS_COUNT // Logic based on TabPanelOfficialBoard.tsx

useEffect(() => {
onSetResultsCount(searchOption.id, searchResultsCount ?? 0)
Expand Down Expand Up @@ -75,6 +77,7 @@ const SearchResults = ({
}}
/>
)}

{searchResultsData?.length ? (
<ul className="flex flex-col rounded-lg border-2 py-2" data-cy="search-results">
{searchResultsData
Expand All @@ -90,7 +93,7 @@ const SearchResults = ({
>
<SearchResultCard
data={{ ...item }}
hideBottomDivider={index === GENERAL_RESULTS_COUNT - 1}
hideBottomDivider={index === (RESULTS_COUNT as number) - 1}
/>
</li>
)
Expand All @@ -106,6 +109,7 @@ const SearchResults = ({
// TODO IS PENDING, but handle contacts separately
<Typography type="p">{t('SearchPage.enterSearchQuery')}</Typography>
)}

{variant === 'specificResults' && onPageChange ? (
<div>
<Pagination
Expand Down

0 comments on commit 7d16d8a

Please sign in to comment.