You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.1 KiB
35 lines
1.1 KiB
import React, { useEffect } from 'react';
|
|
import { useSelector } from 'react-redux'
|
|
import { useAppDispatch } from '../../../../../../redux/store';
|
|
import { fetchPizzaToCard, selectPizzaToCartData } from '../../../../../../redux/pizzaToCart/';
|
|
import { PizzaModalsContent } from './';
|
|
|
|
type Props = {
|
|
id: any;
|
|
otherProp?: any;
|
|
};
|
|
|
|
export const PizzaCard: React.FC<Props> = ({id}) => {
|
|
const dispatch = useAppDispatch();
|
|
|
|
useEffect(() => {
|
|
dispatch( fetchPizzaToCard({id}) );
|
|
}, [dispatch, id]);
|
|
|
|
const { pizzaToCard_items, pizzaToCard_status } = useSelector(selectPizzaToCartData);
|
|
|
|
const pizza = pizzaToCard_items.map((obj, index) => <PizzaModalsContent key={index} {...obj}/> );
|
|
//const pizzaSkeleton = [...new Array(6)].map((_, index) => <PizzaSkeleton key={index} />);
|
|
|
|
return (
|
|
<div id='openModal' className='pizza_modal_card'>
|
|
<div className='dialog'>
|
|
<div className='content'>
|
|
<div className='body'>
|
|
{pizza}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
}; |