import React from 'react' import Link from 'next/link' import * as Icon from 'react-feather' import { useSelector, useDispatch } from 'react-redux' import { useToasts } from 'react-toast-notifications' import { useRouter } from 'next/router' import QtyForm from './QtyForm' //library yarn import NumberFormat from 'react-number-format'; const CartContent = function ({ backend, cart_product, ...props }) { const router = useRouter() const { addToast } = useToasts() const dispatch = useDispatch() const cart = useSelector((state) => state.cart) const total = useSelector((state) => state.total) // console.log(cart) const removeItem = () => { dispatch({ type: 'REMOVE_ITEM', id: pId }) addToast('Cart Removed Successfully', { appearance: 'error' }) } const reset = () => { dispatch({ type: 'RESET' }) addToast('Thanks for your order.', { appearance: 'success' }) router.push('/') } return ( <>
{cart_product.length ? cart_product.map(data => ( )) : ( )}
Product Nama Product Warna Product Harga Product Jumlah Total
item {data.product_name} {data.product_color} {removeItem(data.id)}}>
Tidak Ada Product di Keranjang
Continue Shopping

Cart Totals

{/* { e.preventDefault(); reset() }} className="btn btn-primary">Proceed to Checkout */} Proceed to Checkout
) } export default CartContent