mirror of
https://github.com/vercel/commerce.git
synced 2025-07-23 04:36:49 +00:00
feat: edit activeCustomer
This commit is contained in:
@@ -5,6 +5,13 @@ export const activeCustomerQuery = /* GraphQL */ `
|
|||||||
firstName
|
firstName
|
||||||
lastName
|
lastName
|
||||||
emailAddress
|
emailAddress
|
||||||
|
favorites{
|
||||||
|
items{
|
||||||
|
product{
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
3
next-env.d.ts
vendored
3
next-env.d.ts
vendored
@@ -1,6 +1,3 @@
|
|||||||
/// <reference types="next" />
|
/// <reference types="next" />
|
||||||
/// <reference types="next/types/global" />
|
/// <reference types="next/types/global" />
|
||||||
/// <reference types="next/image-types/global" />
|
/// <reference types="next/image-types/global" />
|
||||||
|
|
||||||
// NOTE: This file should not be edited
|
|
||||||
// see https://nextjs.org/docs/basic-features/typescript for more information.
|
|
||||||
|
@@ -4,16 +4,22 @@ import React, { memo } from 'react'
|
|||||||
import s from './ItemWishList.module.scss'
|
import s from './ItemWishList.module.scss'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
id:string,
|
||||||
isActive?: boolean,
|
isActive?: boolean,
|
||||||
onChange?: () => void
|
onChange?: () => string
|
||||||
}
|
}
|
||||||
|
|
||||||
const ItemWishList = memo(({isActive=false, onChange}:Props) => {
|
const ItemWishList = memo(({id,isActive=false, onChange}:Props) => {
|
||||||
|
// function toggleFavorite(id:string):string|undefined{
|
||||||
|
// // alert(id);
|
||||||
|
// return id;
|
||||||
|
// }
|
||||||
return(
|
return(
|
||||||
<div className={classNames({
|
<div className={classNames({
|
||||||
[s.heartToggle]: true,
|
[s.heartToggle]: true,
|
||||||
[s.isToggleOn]: isActive
|
[s.isToggleOn]: isActive
|
||||||
})}
|
})}
|
||||||
|
// onClick={toggleFavorite(id)}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
>
|
>
|
||||||
<IconHeart />
|
<IconHeart />
|
||||||
|
@@ -17,6 +17,7 @@ export interface ProductCardProps extends ProductCard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ProductCardComponent = ({
|
const ProductCardComponent = ({
|
||||||
|
id,
|
||||||
collection,
|
collection,
|
||||||
name,
|
name,
|
||||||
slug,
|
slug,
|
||||||
@@ -34,6 +35,7 @@ const ProductCardComponent = ({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={s.productCardWarpper}>
|
<div className={s.productCardWarpper}>
|
||||||
<div className={s.cardTop}>
|
<div className={s.cardTop}>
|
||||||
@@ -63,7 +65,7 @@ const ProductCardComponent = ({
|
|||||||
<div className={s.cardMidBot}>
|
<div className={s.cardMidBot}>
|
||||||
<div className={s.productPrice}>{price} {currencyCode}</div>
|
<div className={s.productPrice}>{price} {currencyCode}</div>
|
||||||
<div className={s.wishList}>
|
<div className={s.wishList}>
|
||||||
<ItemWishList />
|
<ItemWishList id={id}/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -33,6 +33,8 @@ const ProductList = ({ data, total = data.length, defaultCurrentPage, onPageChan
|
|||||||
<div className={s.list}>
|
<div className={s.list}>
|
||||||
{
|
{
|
||||||
data.map((product, index) => {
|
data.map((product, index) => {
|
||||||
|
console.log(product);
|
||||||
|
|
||||||
return <ProductCard {...product} key={index} />
|
return <ProductCard {...product} key={index} />
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user