summaryrefslogtreecommitdiffstats
path: root/frontend/components/Cart.js
diff options
context:
space:
mode:
authorWes Bos <wesbos@gmail.com>2018-03-23 11:11:09 -0400
committerWes Bos <wesbos@gmail.com>2018-03-23 11:11:09 -0400
commit4fb8969f6994d8414f388f583d8e270d4e4a67e9 (patch)
treedad4cd0eeda0fdc71e4f925c263668763f2e4dff /frontend/components/Cart.js
parentfa16c52917305e21823294e3a4e384bfeae50da0 (diff)
ya
Diffstat (limited to 'frontend/components/Cart.js')
-rw-r--r--frontend/components/Cart.js5
1 files changed, 1 insertions, 4 deletions
diff --git a/frontend/components/Cart.js b/frontend/components/Cart.js
index fee757e..0a77754 100644
--- a/frontend/components/Cart.js
+++ b/frontend/components/Cart.js
@@ -6,6 +6,7 @@ import formatMoney from '../lib/formatMoney';
import { UIContext } from './UIContext';
import CartItem from './CartItem';
import { CURRENT_USER_QUERY } from '../queries/index';
+import calcTotalPrice from '../lib/calcTotalPrice';
const CartStyles = styled.div`
padding: 20px;
@@ -72,10 +73,6 @@ const CloseButton = styled.button`
right: 0;
`;
-function calcTotalPrice(cart) {
- return cart.reduce((tally, cartItem) => tally + cartItem.quantity * cartItem.item.price, 0);
-}
-
const Cart = props => (
<UIContext.Consumer>
{context => (