feat: edit activeCustomer

This commit is contained in:
Quangnhankie
2021-10-10 14:45:44 +07:00
parent 95f2f0f230
commit 1126030abc
5 changed files with 20 additions and 6 deletions

View File

@@ -5,6 +5,13 @@ export const activeCustomerQuery = /* GraphQL */ `
firstName
lastName
emailAddress
favorites{
items{
product{
id
}
}
}
}
}
`

3
next-env.d.ts vendored
View File

@@ -1,6 +1,3 @@
/// <reference types="next" />
/// <reference types="next/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.

View File

@@ -4,16 +4,22 @@ import React, { memo } from 'react'
import s from './ItemWishList.module.scss'
interface Props {
id:string,
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(
<div className={classNames({
[s.heartToggle]: true,
[s.isToggleOn]: isActive
})}
// onClick={toggleFavorite(id)}
onChange={onChange}
>
<IconHeart />

View File

@@ -17,6 +17,7 @@ export interface ProductCardProps extends ProductCard {
}
const ProductCardComponent = ({
id,
collection,
name,
slug,
@@ -34,6 +35,7 @@ const ProductCardComponent = ({
</div>
}
return (
<div className={s.productCardWarpper}>
<div className={s.cardTop}>
@@ -63,7 +65,7 @@ const ProductCardComponent = ({
<div className={s.cardMidBot}>
<div className={s.productPrice}>{price} {currencyCode}</div>
<div className={s.wishList}>
<ItemWishList />
<ItemWishList id={id}/>
</div>
</div>
</div>

View File

@@ -33,6 +33,8 @@ const ProductList = ({ data, total = data.length, defaultCurrentPage, onPageChan
<div className={s.list}>
{
data.map((product, index) => {
console.log(product);
return <ProductCard {...product} key={index} />
})
}