Skip to content

Commit 9ff82d6

Browse files
committed
Fix search results
1 parent 4adaf19 commit 9ff82d6

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

components/Search/AlgoliaSearchBox.component.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ const AlgoliaSearchBox = () => {
5050
setSearch(text.target.value);
5151
}}
5252
/>
53-
5453
{search && (
5554
<Hits className="absolute" hitComponent={SearchResults} />
5655
)}

components/Search/SearchResults.component.jsx

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,35 @@
11
/**
22
* Displays search results from Algolia
3-
* @param {Object} param0
3+
* @param {Object} props
44
*/
5-
const SearchResults = ({ hit }) => {
5+
const SearchResults = ({
6+
hit: { product_image, product_name, regular_price, sale_price },
7+
}) => {
8+
9+
console.log("Search: ");
10+
console.log(sale_price);
611
return (
712
<article className="hit">
813
<div className="flex p-6 bg-white">
914
<header className="hit-image-container">
1015
<img
11-
src={hit.images.thumbnail.url}
12-
alt={hit.name}
16+
src={product_image}
17+
alt={product_name}
1318
className="w-12 hit-image"
1419
/>
1520
</header>
1621
<div className="pl-4 text-left">
17-
{hit.post_title && (
18-
<span class="text-lg font-bold">{hit.post_title}</span>
22+
{product_name && (
23+
<span class="text-lg font-bold">{product_name}</span>
1924
)}
2025
<br />
21-
{hit.content && <span class="text-base">{hit.content}</span>}
22-
<br />
23-
{hit.price && <span class="text-base">kr {hit.price}</span>}
26+
{sale_price && (
27+
<>
28+
<span className="m-2 text-base line-through">kr {regular_price}</span>
29+
<span className="m-2 text-base">{sale_price}</span>
30+
</>
31+
)}
32+
{!sale_price && <span className="m-2 text-base">kr {regular_price}</span>}
2433
</div>
2534
</div>
2635
</article>

0 commit comments

Comments
 (0)