From b1600adec47a04f60e1da07d94a3ed3906ff5aee Mon Sep 17 00:00:00 2001 From: Wes Bos Date: Thu, 14 Jun 2018 16:44:21 -0400 Subject: starter files --- finished-application/frontend/components/Nav.js | 59 +++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 finished-application/frontend/components/Nav.js (limited to 'finished-application/frontend/components/Nav.js') diff --git a/finished-application/frontend/components/Nav.js b/finished-application/frontend/components/Nav.js new file mode 100644 index 0000000..b483376 --- /dev/null +++ b/finished-application/frontend/components/Nav.js @@ -0,0 +1,59 @@ +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 ( + + {({ data: { me }, error }) => ( + + + Shop + + + Sell + + + {!me && ( + + Sign In + + )} + + {me && ( + + + Orders + + + My Account + + + + {toggleCart => ( + + )} + + + )} + + )} + + ); + } +} + +export default Nav; -- cgit v1.3