summaryrefslogtreecommitdiffstats
path: root/stepped-solutions/FINISHED/frontend/components/Cart.js
diff options
context:
space:
mode:
authorWes Bos <wesbos@gmail.com>2018-09-14 12:18:12 -0400
committerWes Bos <wesbos@gmail.com>2018-09-14 12:18:12 -0400
commit2d145b026cfdf54a63bef0b9d6324b6785390307 (patch)
treef6c1d8f987437803a5c026e70535bf9ff244e885 /stepped-solutions/FINISHED/frontend/components/Cart.js
parent8a5825d52271d712ec7c8348447d433067e13ef2 (diff)
move finished folder
Diffstat (limited to 'stepped-solutions/FINISHED/frontend/components/Cart.js')
-rw-r--r--stepped-solutions/FINISHED/frontend/components/Cart.js66
1 files changed, 0 insertions, 66 deletions
diff --git a/stepped-solutions/FINISHED/frontend/components/Cart.js b/stepped-solutions/FINISHED/frontend/components/Cart.js
deleted file mode 100644
index 2a72b38..0000000
--- a/stepped-solutions/FINISHED/frontend/components/Cart.js
+++ /dev/null
@@ -1,66 +0,0 @@
-import React from 'react';
-import { Query, Mutation } from 'react-apollo';
-import gql from 'graphql-tag';
-import { adopt } from 'react-adopt';
-import User from './User';
-import CartStyles from './styles/CartStyles';
-import Supreme from './styles/Supreme';
-import CloseButton from './styles/CloseButton';
-import SickButton from './styles/SickButton';
-import CartItem from './CartItem';
-import calcTotalPrice from '../lib/calcTotalPrice';
-import formatMoney from '../lib/formatMoney';
-import TakeMyMoney from './TakeMyMoney';
-
-const LOCAL_STATE_QUERY = gql`
- query {
- cartOpen @client
- }
-`;
-
-const TOGGLE_CART_MUTATION = gql`
- mutation {
- toggleCart @client
- }
-`;
-/* eslint-disable */
-const Composed = adopt({
- user: ({ render }) => <User>{render}</User>,
- toggleCart: ({ render }) => <Mutation mutation={TOGGLE_CART_MUTATION}>{render}</Mutation>,
- localState: ({ render }) => <Query query={LOCAL_STATE_QUERY}>{render}</Query>,
-});
-/* eslint-enable */
-
-const Cart = () => (
- <Composed>
- {({ user, toggleCart, localState }) => {
- const me = user.data.me;
- if (!me) return null;
- return (
- <CartStyles open={localState.data.cartOpen}>
- <header>
- <CloseButton onClick={toggleCart} title="close">
- &times;
- </CloseButton>
- <Supreme>{me.name}'s Cart</Supreme>
- <p>
- You Have {me.cart.length} Item{me.cart.length === 1 ? '' : 's'} in your cart.
- </p>
- </header>
- <ul>{me.cart.map(cartItem => <CartItem key={cartItem.id} cartItem={cartItem} />)}</ul>
- <footer>
- <p>{formatMoney(calcTotalPrice(me.cart))}</p>
- {me.cart.length && (
- <TakeMyMoney>
- <SickButton>Checkout</SickButton>
- </TakeMyMoney>
- )}
- </footer>
- </CartStyles>
- );
- }}
- </Composed>
-);
-
-export default Cart;
-export { LOCAL_STATE_QUERY, TOGGLE_CART_MUTATION };