import {OneGood, GoodsNotFound} from "./index"; import {createStore, combineReducers, applyMiddleware, bindActionCreators} from 'redux'; import {getData, actionGoods, actionOrderAddNewGood, urlUpload} from "../reducers/index"; import {Provider, connect} from 'react-redux'; import {BrowserRouter as Router, Route, Link, Switch, Redirect, useHistory} from 'react-router-dom'; // const mapStateToProps = state => ({ // state: state, // arr: getData(state), // // search: getGoods(state) // }); // const mapDispatchToProps = dispatch => bindActionCreators({ // getData: actionGoods // }, dispatch); const GoodsList = ({arr = [], isWish, className = "goods", wishAdd, wishDelete, onAdd, onAddtoOrder}) => { const history = useHistory(); // console.log(arr) if(arr.length == 0) { return( <> ) } return (
{arr.map((good) =>
{isWish.indexOf(good._id) == -1 ? wishAdd (good._id)} xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" className="bi bi-heart" viewBox="0 0 16 16"> : wishDelete (good._id)} xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" className="bi bi-heart-fill" viewBox="0 0 16 16"> }
{(history.location.pathname.includes(`/catalog/`) || history.location.pathname.includes(`/search/`) || history.location.pathname.includes(`/wishes`)) && } {history.location.pathname.includes(`/orderPage/`) && }
)}
) } // const CGoodsList = connect(mapStateToProps, mapDispatchToProps)(GoodsList); export default GoodsList;