rsnext/examples/auth0/components/layout.js
JJ Kasper a73fb5d04a Migrate auth0 example into Next.js repo (#8802)
* Add auth0 example

* Apply suggestions from code review

Co-Authored-By: Joe Haddad <joe.haddad@zeit.co>

* Remove LICENSE

* Add create next-app section

* Update to latest @auth0/nextjs-auth0

* Update user handling

* Update profile link to use <Link>

* Update .env template to reflect guides

* Simplify example

* Update example to prefer API call (temporary hardcoded url)

* Simplify state and ensure rerenders don’t race

* Clear up import being commented

* Make code style consistent

* Update pages to reflect required auth on the client-side

* Memoize the user on window

* Update now.json instruction

* Remove meta fields

* Update docs with explanation

* Update UI for auth0 example
2019-10-01 23:19:04 +02:00

35 lines
769 B
JavaScript

import Head from 'next/head'
import Header from './header'
function Layout ({ user, loading = false, children }) {
return (
<>
<Head>
<title>Next.js with Auth0</title>
</Head>
<Header user={user} loading={loading} />
<main>
<div className='container'>{children}</div>
</main>
<style jsx>{`
.container {
max-width: 42rem;
margin: 1.5rem auto;
}
`}</style>
<style jsx global>{`
body {
margin: 0;
color: #333;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
`}</style>
</>
)
}
export default Layout