File tree Expand file tree Collapse file tree 3 files changed +40
-19
lines changed Expand file tree Collapse file tree 3 files changed +40
-19
lines changed Original file line number Diff line number Diff line change 1
1
import Link from 'next/link' ;
2
2
import { v4 as uuidv4 } from 'uuid' ;
3
3
4
+ import { WOO_CONFIG } from 'utils/config/nextConfig' ;
5
+
4
6
/**
5
7
* Displays all of the products as long as length is defined.
6
8
* Does a map() over the props array and utilizes uuidv4 for unique key values.
@@ -32,19 +34,36 @@ const IndexProducts = ({ products }) => {
32
34
as = { `/produkt/${ slug } ?productId=${ productId } ` }
33
35
>
34
36
< a >
35
- { image && (
37
+ { image ? (
36
38
< img
37
39
id = "product-image"
38
40
className = "transition duration-500 ease-in-out transform cursor-pointer hover:grow hover:shadow-lg hover:scale-105"
39
41
alt = { name }
40
42
src = { image . sourceUrl }
41
43
/>
44
+ ) : (
45
+ < img
46
+ id = "product-image"
47
+ className = "transition duration-500 ease-in-out transform cursor-pointer hover:grow hover:shadow-lg hover:scale-105"
48
+ alt = { name }
49
+ src = { WOO_CONFIG . PLACEHOLDER_IMAGE_URL }
50
+ />
42
51
) }
43
52
</ a >
44
53
</ Link >
45
- < div className = "flex justify-center pt-3" >
46
- < p className = "font-bold text-center" > { name } </ p >
47
- </ div >
54
+ < Link
55
+ href = "/produkt/[post]"
56
+ as = { `/produkt/${ slug } ?productId=${ productId } ` }
57
+ >
58
+ < a >
59
+ < div className = "flex justify-center pt-3" >
60
+ < p className = "font-bold text-center cursor-pointer" >
61
+ { name }
62
+ </ p >
63
+ </ div >
64
+ </ a >
65
+ </ Link >
66
+
48
67
{ /* Display sale price when on sale */ }
49
68
{ onSale && (
50
69
< >
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ export const WOO_CONFIG = {
8
8
ALGOLIA_APP_ID: '7L9M5Y0B1K',
9
9
ALGOLIA_PUBLIC_API_KEY: '925cc92373120f1bf477bb8ce0e71649',
10
10
ALGOLIA_INDEX_NAME: 'dfweb',
11
+ PLACEHOLDER_IMAGE_URL: "https://via.placeholder.com/272",
11
12
};
12
13
*/
13
14
@@ -18,6 +19,7 @@ export const WOO_CONFIG = {
18
19
ALGOLIA_APP_ID : '7L9M5Y0B1K' ,
19
20
ALGOLIA_PUBLIC_API_KEY : '925cc92373120f1bf477bb8ce0e71649' ,
20
21
ALGOLIA_INDEX_NAME : 'dfweb' ,
22
+ PLACEHOLDER_IMAGE_URL : "https://via.placeholder.com/272" ,
21
23
} ;
22
24
23
25
Original file line number Diff line number Diff line change @@ -34,19 +34,19 @@ export const GET_SINGLE_PRODUCT = gql`
34
34
}
35
35
}
36
36
variations {
37
- nodes {
38
- id
39
- variationId
40
- name
41
- stockStatus
42
- stockQuantity
43
- purchasable
44
- onSale
45
- salePrice
46
- regularPrice
37
+ nodes {
38
+ id
39
+ variationId
40
+ name
41
+ stockStatus
42
+ stockQuantity
43
+ purchasable
44
+ onSale
45
+ salePrice
46
+ regularPrice
47
+ }
47
48
}
48
49
}
49
- }
50
50
... on ExternalProduct {
51
51
price
52
52
id
@@ -98,11 +98,11 @@ export const FETCH_FIRST_PRODUCTS_FROM_HOODIES_QUERY = `
98
98
` ;
99
99
100
100
/**
101
- * Fetch all Woocommerce products from GraphQL
101
+ * Fetch first 24 Woocommerce products from GraphQL
102
102
*/
103
103
export const FETCH_ALL_PRODUCTS_QUERY = gql `
104
104
query MyQuery {
105
- products(first: 8 ) {
105
+ products(first: 24 ) {
106
106
nodes {
107
107
productId
108
108
name
@@ -127,11 +127,11 @@ export const FETCH_ALL_PRODUCTS_QUERY = gql`
127
127
` ;
128
128
129
129
/**
130
- * Fetch all categories from GraphQL
130
+ * Fetch first 20 categories from GraphQL
131
131
*/
132
132
export const FETCH_ALL_CATEGORIES_QUERY = gql `
133
133
query Categories {
134
- productCategories(first: 10 ) {
134
+ productCategories(first: 20 ) {
135
135
nodes {
136
136
id
137
137
name
You can’t perform that action at this time.
0 commit comments