diff --git a/app/search/page.tsx b/app/search/page.tsx index 2f7a53bd4..36117171b 100644 --- a/app/search/page.tsx +++ b/app/search/page.tsx @@ -19,23 +19,30 @@ export default async function SearchPage({ const { sortKey, reverse } = sorting.find((item) => item.slug === sort) || defaultSort; const products = await getProducts({ sortKey, reverse, query: searchValue }); - const resultsText = products.length > 1 ? 'results' : 'result'; + const totalProducts = products.length; + const isProductEmpty = totalProduct === 0; + const resultsText = totalProducts > 1 ? 'results' : 'result'; - return ( - <> - {searchValue ? ( + if(searchValue && isProductEmpty){ + return ( +
+ There are no products that match +
+ ) + } + + if(searchValue && !isProductEmpty){ + return ( + <>- {products.length === 0 - ? 'There are no products that match ' - : `Showing ${products.length} ${resultsText} for `} - "{searchValue}" + {`Showing ${totalProducts} ${resultsText} for `}
- ) : null} - {products.length > 0 ? (