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
4646
4747## Features
4848
49- - Next.js version 10 with Next/Image and image optimization for product images
49+ - Next.js version 10
5050- Connect to Woocommerce GraphQL API and list name, price and display image for products
5151- Support for simple products and variable products
5252- Cart handling and checkout with WooCommerce (Cash On Delivery only for now)
@@ -82,3 +82,4 @@ With that said, keep the following in mind:
8282- Display product variation name in cart / checkout
8383- Hide products not in stock
8484- Add better SEO
85+ - Re-add Next/image when it is working better
Original file line number Diff line number Diff line change 11import Link from 'next/link' ;
2- import Image from 'next/image' ;
32import { v4 as uuidv4 } from 'uuid' ;
43
54import WOO_CONFIG from 'utils/config/nextConfig' ;
@@ -17,6 +16,7 @@ const IndexProducts = ({ products }) => {
1716 { products ? (
1817 products . map (
1918 ( {
19+ id,
2020 databaseId,
2121 name,
2222 price,
@@ -30,42 +30,26 @@ const IndexProducts = ({ products }) => {
3030 key = { uuidv4 ( ) }
3131 className = "flex flex-col p-6 md:w-1/2 xl:w-1/4"
3232 >
33- < Link
34- href = "/produkt/[post]"
35- as = { `/produkt/${ slug } ?id=${ databaseId } ` }
36- >
33+ < Link href = "/produkt/[post]" as = { `/produkt/${ slug } ?id=${ databaseId } ` } >
3734 < a >
3835 { image ? (
39- < Image
36+ < img
4037 id = "product-image"
4138 className = "transition duration-500 ease-in-out transform cursor-pointer hover:grow hover:shadow-lg hover:scale-105"
4239 alt = { name }
43- loading = "lazy"
44- quality = "60"
4540 src = { image . sourceUrl }
46- sizes = "(max-width: 900px) 1366px, (min-width: 901px) 272px"
47- width = { 366 }
48- height = { 366 }
4941 />
5042 ) : (
51- < Image
43+ < img
5244 id = "product-image"
5345 className = "transition duration-500 ease-in-out transform cursor-pointer hover:grow hover:shadow-lg hover:scale-105"
5446 alt = { name }
55- loading = "lazy"
56- quality = "60"
5747 src = { WOO_CONFIG . PLACEHOLDER_SMALL_IMAGE_URL }
58- sizes = "(max-width: 900px) 1366px, (min-width: 901px) 272px"
59- width = { 366 }
60- height = { 366 }
6148 />
6249 ) }
6350 </ a >
6451 </ Link >
65- < Link
66- href = "/produkt/[post]"
67- as = { `/produkt/${ slug } ?id=${ databaseId } ` }
68- >
52+ < Link href = "/produkt/[post]" as = { `/produkt/${ slug } ?id=${ databaseId } ` } >
6953 < a >
7054 < div className = "flex justify-center pt-3" >
7155 < p className = "font-bold text-center cursor-pointer" >
Original file line number Diff line number Diff line change 11import { useState , useEffect } from 'react' ;
2- import Image from 'next/image' ;
32
43import AddToCartButton from 'components/Cart/AddToCartButton.component' ;
54import LoadingSpinner from 'components/LoadingSpinner/LoadingSpinner.component' ;
65
7- import WOO_CONFIG from 'utils/config/nextConfig' ;
6+ import WOO_CONFIG from 'utils/config/nextConfig' ;
87
98/**
109 * Shows a single product with an Add To Cart button.
@@ -45,26 +44,18 @@ const SingleProduct = ({ product }) => {
4544 < div className = "container flex flex-wrap items-center pt-4 pb-12 mx-auto " >
4645 < 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" >
4746 { image ? (
48- < Image
47+ < img
4948 id = "product-image"
5049 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"
5150 alt = { name }
5251 src = { image . sourceUrl }
53- loading = "lazy"
54- quality = "60"
55- width = { 600 }
56- height = { 600 }
5752 />
5853 ) : (
59- < Image
54+ < img
6055 id = "product-image"
6156 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"
6257 alt = { name }
6358 src = { WOO_CONFIG . PLACEHOLDER_LARGE_IMAGE_URL }
64- loading = "lazy"
65- quality = "60"
66- width = { 600 }
67- height = { 600 }
6859 />
6960 ) }
7061
You can’t perform that action at this time.
0 commit comments