4
0
forked from crowetic/commerce
This commit is contained in:
Bel Curcio 2021-01-18 20:17:10 -03:00
parent d03df631ce
commit 49b9efa395
7 changed files with 15 additions and 14 deletions

View File

@ -4,11 +4,10 @@ import Image from 'next/image'
import Link from 'next/link' import Link from 'next/link'
import s from './CartItem.module.css' import s from './CartItem.module.css'
import { Trash, Plus, Minus } from '@components/icons' import { Trash, Plus, Minus } from '@components/icons'
import {useUI} from '@components/ui/context' import { useUI } from '@components/ui/context'
import usePrice from '@framework/product/use-price' import usePrice from '@framework/product/use-price'
import useUpdateItem from '@framework/cart/use-update-item' import useUpdateItem from '@framework/cart/use-update-item'
import useRemoveItem from '@framework/cart/use-remove-item' import useRemoveItem from '@framework/cart/use-remove-item'
import { CartItem } from 'framework/types'
const Item = ({ const Item = ({
item, item,
@ -93,7 +92,10 @@ const Item = ({
</div> </div>
<div className="flex-1 flex flex-col text-base"> <div className="flex-1 flex flex-col text-base">
<Link href={`/product/${item.url.split('/')[3]}`}> <Link href={`/product/${item.url.split('/')[3]}`}>
<span className="font-bold mb-5 text-lg cursor-pointer" onClick={() => closeSidebarIfPresent()}> <span
className="font-bold mb-5 text-lg cursor-pointer"
onClick={() => closeSidebarIfPresent()}
>
{item.name} {item.name}
</span> </span>
</Link> </Link>

View File

@ -93,7 +93,7 @@ const CartSidebarView: FC = () => {
My Cart My Cart
</h2> </h2>
<ul className="py-6 space-y-6 sm:py-0 sm:space-y-0 sm:divide-y sm:divide-accents-3 border-t border-accents-3"> <ul className="py-6 space-y-6 sm:py-0 sm:space-y-0 sm:divide-y sm:divide-accents-3 border-t border-accents-3">
{data.products.map((item: any) => ( {data?.products?.map((item) => (
<CartItem <CartItem
key={item.id} key={item.id}
item={item} item={item}

View File

@ -3,7 +3,7 @@ import cn from 'classnames'
import Link from 'next/link' import Link from 'next/link'
import s from './ProductCard.module.css' import s from './ProductCard.module.css'
import Image, { ImageProps } from 'next/image' import Image, { ImageProps } from 'next/image'
import WishlistButton from '@components/wishlist/WishlistButton' // import WishlistButton from '@components/wishlist/WishlistButton'
interface Props { interface Props {
className?: string className?: string
@ -57,11 +57,11 @@ const ProductCard: FC<Props> = ({
{product.price.currencyCode} {product.price.currencyCode}
</span> </span>
</div> </div>
<WishlistButton {/* <WishlistButton
className={s.wishlistButton} className={s.wishlistButton}
productId={product.id} productId={product.id}
variant={product.variants[0]} variant={product.variants[0]}
/> /> */}
</div> </div>
<div className={s.imageContainer}> <div className={s.imageContainer}>
{product?.images && ( {product?.images && (

View File

@ -12,7 +12,7 @@ import usePrice from '@framework/product/use-price'
import { useAddItem } from '@framework/cart' import { useAddItem } from '@framework/cart'
import { getVariant, SelectedOptions } from '../helpers' import { getVariant, SelectedOptions } from '../helpers'
import WishlistButton from '@components/wishlist/WishlistButton' // import WishlistButton from '@components/wishlist/WishlistButton'
interface Props { interface Props {
className?: string className?: string
@ -24,7 +24,7 @@ const ProductView: FC<Props> = ({ product }) => {
const addItem = useAddItem() const addItem = useAddItem()
const { price } = usePrice({ const { price } = usePrice({
amount: product.price.value, amount: product.price.value,
baseAmount: product.price.retailValue, baseAmount: product.price.retailPrice,
currencyCode: product.price.currencyCode!, currencyCode: product.price.currencyCode!,
}) })
const { openSidebar } = useUI() const { openSidebar } = useUI()
@ -152,11 +152,11 @@ const ProductView: FC<Props> = ({ product }) => {
</Button> </Button>
</div> </div>
</div> </div>
<WishlistButton {/* <WishlistButton
className={s.wishlistButton} className={s.wishlistButton}
productId={product.id} productId={product.id}
variant={product.variants[0]!} variant={product.variants[0]!}
/> /> */}
</div> </div>
</Container> </Container>
) )

View File

@ -1 +0,0 @@
export { default } from './WishlistButton'

View File

@ -103,7 +103,7 @@
"webpack": "5.11.1" "webpack": "5.11.1"
}, },
"engines": { "engines": {
"node": ">=14" "node": "12.x"
}, },
"license": "MIT" "license": "MIT"
} }

View File

@ -33,5 +33,5 @@
"**/*.tsx", "**/*.tsx",
"**/*.js" "**/*.js"
], ],
"exclude": ["node_modules"] "exclude": ["node_modules", "components/wishlist"]
} }