diff options
| author | Wes Bos <wesbos@gmail.com> | 2018-09-13 14:18:56 -0400 |
|---|---|---|
| committer | Wes Bos <wesbos@gmail.com> | 2018-09-13 14:18:56 -0400 |
| commit | 8a5825d52271d712ec7c8348447d433067e13ef2 (patch) | |
| tree | ba07c218c1b2d4e59c154f2059b69fd858ae65fe /finished-application/frontend/components/CartItem.js | |
| parent | b0d25a9ad3cc1df2fcc11ddb84e4603b94520b09 (diff) | |
DONE
Diffstat (limited to 'finished-application/frontend/components/CartItem.js')
| -rw-r--r-- | finished-application/frontend/components/CartItem.js | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/finished-application/frontend/components/CartItem.js b/finished-application/frontend/components/CartItem.js deleted file mode 100644 index 6c6d575..0000000 --- a/finished-application/frontend/components/CartItem.js +++ /dev/null @@ -1,53 +0,0 @@ -import styled from 'styled-components'; -import PropTypes from 'prop-types'; -import formatMoney from '../lib/formatMoney'; -import RemoveFromCart from './RemoveFromCart'; - -const CartItemStyles = styled.li` - padding: 1rem 0; - border-bottom: 1px solid ${props => props.theme.lightgrey}; - display: grid; - align-items: center; - grid-template-columns: auto 1fr auto; - img { - margin-right: 10px; - } - h3 { - margin: 0; - } - p { - margin: 0; - } -`; - -const CartItem = ({ cartItem }) => { - if (!cartItem.item) - return ( - <CartItemStyles key={cartItem.id}> - <p>Ack! That Item is gone!</p> - <RemoveFromCart id={cartItem.id} /> - </CartItemStyles> - ); - return ( - <CartItemStyles key={cartItem.id}> - <img width="100" src={cartItem.item.image} alt={cartItem.item.title} /> - <div className="cart-item-details"> - <h3>{cartItem.item.title}</h3> - <p> - {formatMoney(cartItem.quantity * cartItem.item.price)} - {' — '} - <em> - {cartItem.quantity} × {formatMoney(cartItem.item.price)} each - </em> - </p> - </div> - <RemoveFromCart id={cartItem.id} /> - </CartItemStyles> - ); -}; - -CartItem.propTypes = { - cartItem: PropTypes.object.isRequired, -}; - -export default CartItem; |
