Created
April 9, 2019 18:15
-
-
Save gje4/407883ef549bf90d654527f0ed0bc7c7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Link from 'next/link' | |
import Head from 'next/head' | |
import Router from 'next/router' | |
import NProgress from 'nprogress' | |
import { Menu, Container, Image, Icon } from 'semantic-ui-react' | |
import Search from './Search' | |
Router.onRouteChangeStart = url => NProgress.start() | |
Router.onRouteChangeComplete = () => NProgress.done() | |
Router.onRouteChangeError = () => NProgress.done() | |
export default ({ token }) => ( | |
<React.Fragment> | |
<Head> | |
(function (){' '} | |
{ | |
<script | |
dangerouslySetInnerHTML={{ | |
__html: ` | |
var setup = { | |
photo: ["impreseePhoto", "6ae083a8-0a63-4767-9e90-39f934aad38a"], | |
sketch: ["impreseeSketch", "bbb9d127-1964-47be-9cff-eedca8c7d26f"] | |
} | |
var impresee = document.createElement('script'); | |
impresee.type = 'text/javascript'; | |
impresee.async = true; | |
impresee.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'api.impresee.com/snippet/v1.0/impresee.js'; | |
var first = document.getElementsByTagName('script') [0]; | |
first.parentNode.insertBefore(impresee, first);` | |
}} | |
/> | |
})(); | |
<link rel="stylesheet" type="text/css" href="/static/nprogress.css" /> | |
</Head> | |
<Menu inverted fixed="top" size="huge"> | |
<Container text> | |
<Link href="/" prefetch passHref> | |
<Menu.Item as="a" header> | |
<Image | |
size="mini" | |
src="/static/moltin-light-hex.svg" | |
style={{ marginRight: '1.5em' }} | |
/> | |
NextJS Store | |
</Menu.Item> | |
</Link> | |
{token ? ( | |
<Link href="/myaccount" passHref> | |
<Menu.Item>My account</Menu.Item> | |
</Link> | |
) : ( | |
[ | |
<Link href="/register" passHref prefetch key="register"> | |
<Menu.Item>Sign up</Menu.Item> | |
</Link>, | |
<Link href="/login" passHref prefetch key="login"> | |
<Menu.Item>Sign in</Menu.Item> | |
</Link> | |
] | |
)} | |
<Link href="/cart" passHref> | |
<Menu.Item position="right" name="cart"> | |
<Icon name="cart" /> | |
Cart | |
</Menu.Item> | |
</Link> | |
</Container> | |
<Search style={{ padding: '1.5em', marginRight: '5.5em' }} /> | |
</Menu> | |
</React.Fragment> | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment