From 8a5825d52271d712ec7c8348447d433067e13ef2 Mon Sep 17 00:00:00 2001 From: Wes Bos Date: Thu, 13 Sep 2018 14:18:56 -0400 Subject: DONE --- finished-application/frontend/components/Cart.js | 74 ------------------------ 1 file changed, 74 deletions(-) delete mode 100644 finished-application/frontend/components/Cart.js (limited to 'finished-application/frontend/components/Cart.js') diff --git a/finished-application/frontend/components/Cart.js b/finished-application/frontend/components/Cart.js deleted file mode 100644 index 7e8a9c5..0000000 --- a/finished-application/frontend/components/Cart.js +++ /dev/null @@ -1,74 +0,0 @@ -import React from 'react'; -import { Mutation, Query } from 'react-apollo'; -import { adopt } from 'react-adopt'; -import gql from 'graphql-tag'; -import TakeMyMoney from './TakeMyMoney'; -import formatMoney from '../lib/formatMoney'; -import CartItem from './CartItem'; -import { CURRENT_USER_QUERY } from './User'; -import calcTotalPrice from '../lib/calcTotalPrice'; -import Error from './ErrorMessage'; -import CartStyles from './styles/CartStyles'; -import Supreme from './styles/Supreme'; -import CloseButton from './styles/CloseButton'; -import SickButton from './styles/SickButton'; - -const LOCAL_STATE_QUERY = gql` - query { - cartOpen @client - } -`; - -const TOGGLE_CART_MUTATION = gql` - mutation { - toggleCart @client - } -`; - -const Composed = adopt({ - toggleCart: ({ render }) => ( - - {(mutate, result) => render({ mutate, result })} - - ), - localState: ({ render }) => , - currentUser: ({ render }) => ( - - ), -}); - -const Cart = () => ( - - {({ toggleCart, localState, currentUser }) => { - const { data: { me }, error, loading } = currentUser; - if (loading) return

Loading...

; - if (error) return ; - if (!me) return null; - return ( - -
- - × - - - {me.name}'s Cart. -

- You have {me.cart.length} item{me.cart.length === 1 ? '' : 's'} in your cart. -

-
- -
    {me.cart.map(cartItem => )}
- -
- ); - }} -
-); - -export default Cart; -export { LOCAL_STATE_QUERY, TOGGLE_CART_MUTATION }; -- cgit v1.3