Skip to content
This repository has been archived by the owner on Apr 26, 2022. It is now read-only.

Commit

Permalink
feat: Add product images for cart items (#2)
Browse files Browse the repository at this point in the history
* feat: Add product images for cart items

* fix: Fallback to Moltin hex if no cart image
  • Loading branch information
ynnoj committed May 8, 2018
1 parent 7591c12 commit 8d062b1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion components/CartItemList.js
Expand Up @@ -23,8 +23,9 @@ export default ({ items, removeFromCart, loading, completed }) => {
)

const mapCartItemsToItems = items =>
items.map(({ id, product_id, name, quantity, meta }) => {
items.map(({ id, product_id, name, quantity, meta, image }) => {
const price = meta.display_price.with_tax.unit.formatted || ''
const imageUrl = image.href || '/static/moltin-light-hex.svg'

return {
childKey: id,
Expand All @@ -33,6 +34,7 @@ export default ({ items, removeFromCart, loading, completed }) => {
<Item.Header as="a">{name}</Item.Header>
</Link>
),
image: imageUrl,
meta: `${quantity}x ${price}`,
extra: (
<Button
Expand Down

0 comments on commit 8d062b1

Please sign in to comment.