import type { FC } from 'react' import cn from 'classnames' import Link from 'next/link' import type { ProductNode } from '@bigcommerce/storefront-data-hooks/api/operations/get-all-products' import usePrice from '@bigcommerce/storefront-data-hooks/use-price' import Image from 'next/image' import s from './ProductCard.module.css' import WishlistButton from '@components/wishlist/WishlistButton' interface Props { className?: string product: ProductNode variant?: 'slim' | 'simple' imgWidth: number | string imgHeight: number | string imgLayout?: 'fixed' | 'intrinsic' | 'responsive' | undefined imgPriority?: boolean imgLoading?: 'eager' | 'lazy' imgSizes?: string } 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!, }) return ( {variant === 'slim' ? (
{p.name}
{p.images.edges?.[0]?.node.altText
) : ( <>

{p.name}

{price}
{p.name}
)}
) } export default ProductCard