diff --git a/components/product/ProductCard/FUTURE_ProductCard.tsx b/components/product/ProductCard/FUTURE_ProductCard.tsx deleted file mode 100644 index 6ccc79fb9..000000000 --- a/components/product/ProductCard/FUTURE_ProductCard.tsx +++ /dev/null @@ -1,81 +0,0 @@ -import { FC } from 'react' -import cn from 'classnames' -import Link from 'next/link' -import s from './ProductCard.module.css' -import Image, { ImageProps } from 'next/image' -import WishlistButton from '@components/wishlist/WishlistButton' - -interface Props { - className?: string - product: Product - variant?: 'slim' | 'simple' - imgProps?: Omit -} - -const ProductCard: FC = ({ className, product, variant, imgProps }) => { - return ( - - - {variant === 'slim' ? ( -
-
- - {product.name} - -
- {product.images[0] && ( - {product.name} - )} -
- ) : ( - <> -
-
-
-

- {product.name} -

- - {product.prices[0].value} -   - {product.prices[0].currencyCode} - -
- -
-
- {product.images[0] && ( - {product.name} - )} -
- - )} -
- - ) -} - -export default ProductCard diff --git a/components/product/ProductCard/ProductCard.tsx b/components/product/ProductCard/ProductCard.tsx index 58a201e8b..6ccc79fb9 100644 --- a/components/product/ProductCard/ProductCard.tsx +++ b/components/product/ProductCard/ProductCard.tsx @@ -1,45 +1,20 @@ +import { FC } from 'react' import cn from 'classnames' import Link from 'next/link' -import Image from 'next/image' -import type { FC } from 'react' import s from './ProductCard.module.css' +import Image, { ImageProps } from 'next/image' import WishlistButton from '@components/wishlist/WishlistButton' -import usePrice from '@framework/product/use-price' -import type { ProductNode } from '@framework/api/operations/get-all-products' - interface Props { className?: string - product: ProductNode + product: Product variant?: 'slim' | 'simple' - imgWidth: number | string - imgHeight: number | string - imgLayout?: 'fixed' | 'intrinsic' | 'responsive' | undefined - imgPriority?: boolean - imgLoading?: 'eager' | 'lazy' - imgSizes?: string + imgProps?: Omit } -const ProductCard: FC = ({ - className, - product: p, - variant, - imgWidth, - imgHeight, - imgPriority, - imgLoading, - imgSizes, - imgLayout = 'responsive', -}) => { - const src = p.images.edges?.[0]?.node?.urlOriginal! - const { price } = usePrice({ - amount: p.prices?.price?.value, - baseAmount: p.prices?.retailPrice?.value, - currencyCode: p.prices?.price?.currencyCode!, - }) - +const ProductCard: FC = ({ className, product, variant, imgProps }) => { return ( - + @@ -47,20 +22,20 @@ const ProductCard: FC = ({
- {p.name} + {product.name}
- {p.images.edges?.[0]?.node.altText + {product.images[0] && ( + {product.name} + )}
) : ( <> @@ -68,29 +43,33 @@ const ProductCard: FC = ({

- {p.name} + {product.name}

- {price} + + {product.prices[0].value} +   + {product.prices[0].currencyCode} +
- {p.name} + {product.images[0] && ( + {product.name} + )}
)} diff --git a/pages/index.tsx b/pages/index.tsx index 9bb1e09a6..76299673d 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -1,7 +1,6 @@ -import rangeMap from '@lib/range-map' import { Layout } from '@components/common' -import ProductCard from '@components/product/ProductCard/FUTURE_ProductCard' import { Grid, Marquee, Hero } from '@components/ui' +import { ProductCard } from '@components/product' import HomeAllProductsGrid from '@components/common/HomeAllProductsGrid' import type { GetStaticPropsContext, InferGetStaticPropsType } from 'next'