import React from 'react';
import style from './favouriteGoodsContainer.module.sass';
import {connect} from 'react-redux';
import UserCabinetGoodsElement from '../../../userCabinetGoodsElement/userCabinetGoodsElement';

const FavouriteGoodsContainer = (props) => {

    return (
      <div className={style.mainContainer}>
          {
              props.favouriteGoods && props.favouriteGoods.map((elem, index) => {
                 return (
                   <UserCabinetGoodsElement
                       key={index}
                       simpleGoodsData={elem}
                       typeElement={"favouriteGoodsElement"}
                   />
                 );
              })
          }
      </div>
    );
};

const mapStateToProps = state => {
    const {favouriteGoods} = state.favouriteGoodsReducers;

    return {
        favouriteGoods
    }
};


export default connect(mapStateToProps)(FavouriteGoodsContainer);