File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,15 @@ import Link from 'next/link';
2
2
3
3
/**
4
4
* Displays search results from Algolia
5
- * @param {Object } props
5
+ * @param {Object } hit {
6
+ * @param {String } product_image Product image from WooCommerce
7
+ * @param {String } product_name Name of product
8
+ * @param {Float } regular_price Price without discount
9
+ * @param {Float } sale_price Price when on sale
10
+ * @param {Boolean } on_sale Is the product on sale? True or false
11
+ * @param {String } short_description Short description of product
12
+ * @param {Integer } objectID ID of product
13
+ }
6
14
*/
7
15
const SearchResults = ( {
8
16
hit : {
@@ -15,11 +23,14 @@ const SearchResults = ({
15
23
objectID,
16
24
} ,
17
25
} ) => {
26
+ // Replace empty spaces with dash (-)
27
+ const trimmedProductName = product_name . replace ( / / g, '-' ) ;
28
+
18
29
return (
19
30
< article className = "cursor-pointer hit" >
20
31
< Link
21
32
href = "/produkt/[post]"
22
- as = { `/produkt/${ product_name } ?productId=${ objectID } ` }
33
+ as = { `/produkt/${ trimmedProductName } ?productId=${ objectID } ` }
23
34
>
24
35
< div className = "flex p-6 bg-white" >
25
36
< header className = "hit-image-container" >
You can’t perform that action at this time.
0 commit comments