File tree Expand file tree Collapse file tree 3 files changed +10
-34
lines changed Expand file tree Collapse file tree 3 files changed +10
-34
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ The current release has been tested and is confirmed working with the following
46
46
47
47
## Features
48
48
49
- - Next.js version 10 with Next/Image and image optimization for product images
49
+ - Next.js version 10
50
50
- Connect to Woocommerce GraphQL API and list name, price and display image for products
51
51
- Support for simple products and variable products
52
52
- Cart handling and checkout with WooCommerce (Cash On Delivery only for now)
@@ -82,3 +82,4 @@ With that said, keep the following in mind:
82
82
- Display product variation name in cart / checkout
83
83
- Hide products not in stock
84
84
- Add better SEO
85
+ - Re-add Next/image when it is working better
Original file line number Diff line number Diff line change 1
1
import Link from 'next/link' ;
2
- import Image from 'next/image' ;
3
2
import { v4 as uuidv4 } from 'uuid' ;
4
3
5
4
import WOO_CONFIG from 'utils/config/nextConfig' ;
@@ -17,6 +16,7 @@ const IndexProducts = ({ products }) => {
17
16
{ products ? (
18
17
products . map (
19
18
( {
19
+ id,
20
20
databaseId,
21
21
name,
22
22
price,
@@ -30,42 +30,26 @@ const IndexProducts = ({ products }) => {
30
30
key = { uuidv4 ( ) }
31
31
className = "flex flex-col p-6 md:w-1/2 xl:w-1/4"
32
32
>
33
- < Link
34
- href = "/produkt/[post]"
35
- as = { `/produkt/${ slug } ?id=${ databaseId } ` }
36
- >
33
+ < Link href = "/produkt/[post]" as = { `/produkt/${ slug } ?id=${ databaseId } ` } >
37
34
< a >
38
35
{ image ? (
39
- < Image
36
+ < img
40
37
id = "product-image"
41
38
className = "transition duration-500 ease-in-out transform cursor-pointer hover:grow hover:shadow-lg hover:scale-105"
42
39
alt = { name }
43
- loading = "lazy"
44
- quality = "60"
45
40
src = { image . sourceUrl }
46
- sizes = "(max-width: 900px) 1366px, (min-width: 901px) 272px"
47
- width = { 366 }
48
- height = { 366 }
49
41
/>
50
42
) : (
51
- < Image
43
+ < img
52
44
id = "product-image"
53
45
className = "transition duration-500 ease-in-out transform cursor-pointer hover:grow hover:shadow-lg hover:scale-105"
54
46
alt = { name }
55
- loading = "lazy"
56
- quality = "60"
57
47
src = { WOO_CONFIG . PLACEHOLDER_SMALL_IMAGE_URL }
58
- sizes = "(max-width: 900px) 1366px, (min-width: 901px) 272px"
59
- width = { 366 }
60
- height = { 366 }
61
48
/>
62
49
) }
63
50
</ a >
64
51
</ Link >
65
- < Link
66
- href = "/produkt/[post]"
67
- as = { `/produkt/${ slug } ?id=${ databaseId } ` }
68
- >
52
+ < Link href = "/produkt/[post]" as = { `/produkt/${ slug } ?id=${ databaseId } ` } >
69
53
< a >
70
54
< div className = "flex justify-center pt-3" >
71
55
< p className = "font-bold text-center cursor-pointer" >
Original file line number Diff line number Diff line change 1
1
import { useState , useEffect } from 'react' ;
2
- import Image from 'next/image' ;
3
2
4
3
import AddToCartButton from 'components/Cart/AddToCartButton.component' ;
5
4
import LoadingSpinner from 'components/LoadingSpinner/LoadingSpinner.component' ;
6
5
7
- import WOO_CONFIG from 'utils/config/nextConfig' ;
6
+ import WOO_CONFIG from 'utils/config/nextConfig' ;
8
7
9
8
/**
10
9
* Shows a single product with an Add To Cart button.
@@ -45,26 +44,18 @@ const SingleProduct = ({ product }) => {
45
44
< div className = "container flex flex-wrap items-center pt-4 pb-12 mx-auto " >
46
45
< div className = "grid grid-cols-1 gap-4 mt-16 lg:grid-cols-2 xl:grid-cols-2 md:grid-cols-2 sm:grid-cols-2" >
47
46
{ image ? (
48
- < Image
47
+ < img
49
48
id = "product-image"
50
49
className = "h-auto p-8 transition duration-500 ease-in-out transform xl:p-2 md:p-2 lg:p-2 hover:grow hover:shadow-lg hover:scale-105"
51
50
alt = { name }
52
51
src = { image . sourceUrl }
53
- loading = "lazy"
54
- quality = "60"
55
- width = { 600 }
56
- height = { 600 }
57
52
/>
58
53
) : (
59
- < Image
54
+ < img
60
55
id = "product-image"
61
56
className = "h-auto p-8 transition duration-500 ease-in-out transform xl:p-2 md:p-2 lg:p-2 hover:grow hover:shadow-lg hover:scale-105"
62
57
alt = { name }
63
58
src = { WOO_CONFIG . PLACEHOLDER_LARGE_IMAGE_URL }
64
- loading = "lazy"
65
- quality = "60"
66
- width = { 600 }
67
- height = { 600 }
68
59
/>
69
60
) }
70
61
You can’t perform that action at this time.
0 commit comments