summaryrefslogtreecommitdiffstats
path: root/finished-application/frontend/components/Nav.js
diff options
context:
space:
mode:
Diffstat (limited to 'finished-application/frontend/components/Nav.js')
-rw-r--r--finished-application/frontend/components/Nav.js59
1 files changed, 0 insertions, 59 deletions
diff --git a/finished-application/frontend/components/Nav.js b/finished-application/frontend/components/Nav.js
deleted file mode 100644
index 5f3495a..0000000
--- a/finished-application/frontend/components/Nav.js
+++ /dev/null
@@ -1,59 +0,0 @@
-import React, { Fragment } from 'react';
-import Link from 'next/link';
-import { Query, Mutation } from 'react-apollo';
-import { TOGGLE_CART_MUTATION } from './Cart';
-import User from './User';
-import CartCount from './CartCount';
-import Signout from './Signout';
-import NavStyles from './styles/NavStyles';
-
-class Nav extends React.Component {
- render() {
- // below we set the fetchPolicy to network only so it forces re-fetch on the server
- return (
- <User>
- {({ data: { me } }) => (
- <NavStyles data-test="nav">
- <Link href="/items">
- <a>Shop</a>
- </Link>
- <Link href="/sell">
- <a>Sell</a>
- </Link>
-
- {!me && (
- <Link href="/signup">
- <a>Sign In</a>
- </Link>
- )}
-
- {me && (
- <Fragment>
- <Link href="/orders">
- <a>Orders</a>
- </Link>
- <Link href="/me">
- <a>My Account</a>
- </Link>
- <Signout />
- <Mutation mutation={TOGGLE_CART_MUTATION}>
- {toggleCart => (
- <button onClick={toggleCart}>
- My Cart
- <CartCount
- className="cart-count"
- count={me.cart.reduce((tally, cartItem) => tally + cartItem.quantity, 0)}
- />
- </button>
- )}
- </Mutation>
- </Fragment>
- )}
- </NavStyles>
- )}
- </User>
- );
- }
-}
-
-export default Nav;