@shopgate/engage
Version:
Shopgate's ENGAGE library.
6 lines • 1.07 kB
JavaScript
import React from'react';import PropTypes from'prop-types';import Item from"../Item";import styles from"./styles";/**
* Wrapper around the Item component to simplify item rendering based on the two different "items"
* lists within ListItemContent.
* @param {Object} props The component props
* @returns {JSX.Element}
*/var ListItemWrapper=function ListItemWrapper(_ref){var listId=_ref.listId,product=_ref.product,notes=_ref.notes,quantity=_ref.quantity,_addToCart=_ref.addToCart,removeItem=_ref.removeItem,items=_ref.items,index=_ref.index;return React.createElement("div",null,React.createElement(Item,{product:product,notes:notes,quantity:quantity,listId:listId,productId:product.id,addToCart:function addToCart(e){e.preventDefault();e.stopPropagation();return _addToCart(product,quantity);},remove:function remove(e){e.preventDefault();e.stopPropagation();removeItem(product.id);}}),index===items.length-1?null:React.createElement("div",{className:styles.divider}));};ListItemWrapper.defaultProps={notes:undefined,quantity:1};export default ListItemWrapper;