From 46a0ba30ef54a7e36206481a4f5b2bf1f9702fca Mon Sep 17 00:00:00 2001 From: Wes Bos Date: Mon, 12 Mar 2018 14:06:25 -0400 Subject: wip --- frontend/components/Nav.js | 89 ++++++++++++++++++++++++++-------------------- 1 file changed, 51 insertions(+), 38 deletions(-) (limited to 'frontend/components/Nav.js') diff --git a/frontend/components/Nav.js b/frontend/components/Nav.js index 9793087..aa0300b 100644 --- a/frontend/components/Nav.js +++ b/frontend/components/Nav.js @@ -1,8 +1,11 @@ import Link from 'next/link'; import styled from 'styled-components'; +import { Fragment } from 'react'; import { userEnhancer } from '../enhancers/enhancers'; import { compose } from 'react-apollo'; -import ToggleCart from './ToggleCart'; +import CartCount from './CartCount'; +import Signout from './Signout'; +import { UIContext } from './UIContext'; const StyledUl = styled.ul` margin: 0; @@ -20,6 +23,7 @@ const StyledUl = styled.ul` font-size: 2rem; background: none; border: 0; + cursor: pointer; &:before { content: ''; width: 1px; @@ -51,45 +55,54 @@ const StyledUl = styled.ul` } } } - .cart-count { - background: ${props => props.theme.red}; - color: white; - border-radius: 50%; - padding: 5px; - margin-left: 1rem; - font-weight: 100; - font-feature-settings: 'tnum'; - font-variant-numeric: tabular-nums; - } `; -const Nav = ({ currentUser }) => ( - - - Shop - - - Sell - - - Sign Up - - - Orders - - {currentUser.me ? ( - ( - +class Nav extends React.Component { + componentDidMount() { + this.props.currentUser.refetch(); + } + render() { + const { currentUser } = this.props; + return ( + + + Shop + + + Sell + + + {!currentUser.me && ( + + Sign In + )} - /> - ) : null} - -); + + {currentUser.me && ( + + + Orders + + + My Account + + + + {context => ( + + )} + + + )} + + ); + } +} export default compose(userEnhancer)(Nav); -- cgit v1.3