import React, { useState } from 'react'; import Link from "next/link"; import classNames from 'classnames'; import { useSelector } from 'react-redux'; import { HiMinus, HiPlus } from "react-icons/hi"; import { CardBasketProduct, CardAdditionally } from './' import { BoxScroll } from '../../../../../../components/customer/containers'; import { Button } from '../../../../../UI'; import { selectCart } from './redux/selectors'; type PizzaProps = { id: string; title: string; heft: string[]; description: string; img: string[]; price: string[]; size: string[]; }; const types=[0,1], sizes=[30,40,50], sum=0, typeNames = ['традиционное тесто','тонкое тесто'] ; export const PizzaModalsContentCart: React.FC = ({ id, title, img, heft, description, price, size, }) => { const [additionally, setAdditionally] = useState([{src:'/assets/img/coca.png', name: 'Coca', price: 100}, {src:'/assets/img/coca.png', name: 'Coca', price: 100}, {src:'/assets/img/coca.png', name: 'Coca', price: 100}, {src:'/assets/img/coca.png', name: 'Coca', price: 100}, {src:'/assets/img/coca.png', name: 'Coca', price: 100},]); const [delivery, setDelivery] = useState(0); const { totalPrice, items } = useSelector(selectCart); const totalCount = items.reduce((sum: number, item: any) => sum + item.count, 0); const [ sum, setSum ] = useState(totalPrice + delivery); const addBasket = () => { console.log('add'); } const sizeText = [{size:30, text: 'маленькая 30 см, '},{size:40, text: 'средняя 40 см, '}, {size:50, text: 'большая 50 см, '}] return ( <>

{totalCount} товар на {totalPrice} р

{Object.keys(items).length > 0 ? items.map((rows, count) => el.size === rows.size)?.text +' '+ rows.type} sum={rows.sum}/> ) :

Корзина пуста

}
{Object.keys(items).length > 0 ?

Добавить к заказу?

{additionally.map((name, count) => ) }
: '' }

Доставка

{delivery} ₽

{totalCount} товар(а)

{totalPrice} ₽

Итого

{totalPrice + delivery} ₽

); };