Skip to content

Commit a346cf5

Browse files
fix: empty results message is at a wrong position in blog layout (#989)
* bring no results message out of the collectionresults div * remove extra empty div * replace !== 0 with > 0 --------- Co-authored-by: Park Se Hyun <> Co-authored-by: adriangohjw <[email protected]>
1 parent 63e410a commit a346cf5

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

packages/components/src/templates/next/layouts/Collection/CollectionResults.tsx

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ export const CollectionResults = ({
8181
</div>
8282
</div>
8383
{/* NOTE: DO NOT add h-full to this div as it will break old browsers */}
84-
<div className={collectionResults()}>
85-
{paginatedItems.length > 0 &&
86-
paginatedItems.map((item) =>
84+
{paginatedItems.length > 0 ? (
85+
<div className={collectionResults()}>
86+
{paginatedItems.map((item) =>
8787
variant === "collection" ? (
8888
<CollectionCard
8989
key={`${item.title}-${item.category}`}
@@ -102,21 +102,21 @@ export const CollectionResults = ({
102102
/>
103103
),
104104
)}
105-
{paginatedItems.length === 0 && (
106-
<div className="flex flex-col gap-1 py-32 text-center text-content">
107-
<p className="prose-body-base">
108-
We couldn’t find any articles. Try different search terms or
109-
filters.
110-
</p>
111-
<button
112-
className="prose-headline-base-medium mx-auto w-fit text-link underline-offset-4 hover:underline"
113-
onClick={handleClearFilter}
114-
>
115-
Clear search and filters
116-
</button>
117-
</div>
118-
)}
119-
</div>
105+
</div>
106+
) : (
107+
<div className="flex flex-col gap-1 py-32 text-center text-content">
108+
<p className="prose-body-base">
109+
We couldn’t find any articles. Try different search terms or
110+
filters.
111+
</p>
112+
<button
113+
className="prose-headline-base-medium mx-auto w-fit text-link underline-offset-4 hover:underline"
114+
onClick={handleClearFilter}
115+
>
116+
Clear search and filters
117+
</button>
118+
</div>
119+
)}
120120
</>
121121
)
122122
}

0 commit comments

Comments
 (0)