mirror of
https://github.com/vercel/commerce.git
synced 2025-07-24 10:41:23 +00:00
Adding Features APO
This commit is contained in:
@@ -4,8 +4,6 @@ import Link from 'next/link'
|
||||
import type { Product } from '@commerce/types'
|
||||
import s from './ProductCard.module.css'
|
||||
import Image, { ImageProps } from 'next/image'
|
||||
import frameworkConfig from '@framework/config.json'
|
||||
const isWishlistEnabled = !!frameworkConfig.features.wishlist
|
||||
import WishlistButton from '@components/wishlist/WishlistButton'
|
||||
|
||||
interface Props {
|
||||
@@ -13,6 +11,7 @@ interface Props {
|
||||
product: Product
|
||||
variant?: 'slim' | 'simple'
|
||||
imgProps?: Omit<ImageProps, 'src'>
|
||||
wishlist?: boolean
|
||||
}
|
||||
|
||||
const placeholderImg = '/product-img-placeholder.svg'
|
||||
@@ -22,6 +21,7 @@ const ProductCard: FC<Props> = ({
|
||||
product,
|
||||
variant,
|
||||
imgProps,
|
||||
wishlist = false,
|
||||
...props
|
||||
}) => (
|
||||
<Link href={`/product/${product.slug}`} {...props}>
|
||||
@@ -59,7 +59,7 @@ const ProductCard: FC<Props> = ({
|
||||
{product.price.currencyCode}
|
||||
</span>
|
||||
</div>
|
||||
{isWishlistEnabled && (
|
||||
{wishlist && (
|
||||
<WishlistButton
|
||||
className={s.wishlistButton}
|
||||
productId={product.id}
|
||||
|
@@ -13,15 +13,16 @@ import usePrice from '@framework/product/use-price'
|
||||
import { useAddItem } from '@framework/cart'
|
||||
|
||||
import { getVariant, SelectedOptions } from '../helpers'
|
||||
// import WishlistButton from '@components/wishlist/WishlistButton'
|
||||
import WishlistButton from '@components/wishlist/WishlistButton'
|
||||
|
||||
interface Props {
|
||||
className?: string
|
||||
children?: any
|
||||
product: Product
|
||||
wishlist?: boolean
|
||||
}
|
||||
|
||||
const ProductView: FC<Props> = ({ product }) => {
|
||||
const ProductView: FC<Props> = ({ product, wishlist = false }) => {
|
||||
const addItem = useAddItem()
|
||||
const { price } = usePrice({
|
||||
amount: product.price.value,
|
||||
@@ -151,11 +152,13 @@ const ProductView: FC<Props> = ({ product }) => {
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
{/* <WishlistButton
|
||||
className={s.wishlistButton}
|
||||
productId={product.id}
|
||||
variant={product.variants[0]!}
|
||||
/> */}
|
||||
{wishlist && (
|
||||
<WishlistButton
|
||||
className={s.wishlistButton}
|
||||
productId={product.id}
|
||||
variant={product.variants[0]!}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</Container>
|
||||
)
|
||||
|
Reference in New Issue
Block a user