-
Notifications
You must be signed in to change notification settings - Fork 27k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'canary' into fix/fixed_warning_unique_key_for_scripts_w…
…ith_beforeinteractive
- Loading branch information
Showing
239 changed files
with
1,552 additions
and
943 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# Learn how to add code owners here: | ||
# https://help.github.com/en/articles/about-code-owners | ||
|
||
* @timneutkens @ijjk @lfades @divmain @shuding | ||
/docs/ @timneutkens @ijjk @lfades @divmain @shuding @leerob | ||
/examples/ @timneutkens @ijjk @lfades @divmain @shuding @leerob | ||
* @timneutkens @ijjk @shuding @styfle @huozhi @padmaia | ||
/docs/ @timneutkens @ijjk @shuding @styfle @huozhi @padmaia @leerob @lfades | ||
/examples/ @timneutkens @ijjk @shuding @styfle @huozhi @padmaia @leerob @lfades |
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,13 @@ | ||
import Link from 'next/link' | ||
import Head from 'next/head' | ||
import styles from './layout.module.css' | ||
|
||
export default function Layout({ | ||
children, | ||
title = 'This is the default title', | ||
}) { | ||
export default function Layout({ children }) { | ||
return ( | ||
<div> | ||
<> | ||
<Head> | ||
<title>{title}</title> | ||
<meta charSet="utf-8" /> | ||
<meta name="viewport" content="initial-scale=1.0, width=device-width" /> | ||
<title>Layouts Example</title> | ||
</Head> | ||
<header> | ||
<nav> | ||
<Link href="/"> | ||
<a>Home</a> | ||
</Link>{' '} | ||
| | ||
<Link href="/about"> | ||
<a>About</a> | ||
</Link>{' '} | ||
| | ||
<Link href="/contact"> | ||
<a>Contact</a> | ||
</Link> | ||
</nav> | ||
</header> | ||
|
||
{children} | ||
|
||
<footer>{'I`m here to stay'}</footer> | ||
</div> | ||
<main className={styles.main}>{children}</main> | ||
</> | ||
) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.main { | ||
display: flex; | ||
height: calc(100vh - 64px); | ||
background-color: white; | ||
} | ||
|
||
.main > section { | ||
padding: 32px; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import Link from 'next/link' | ||
import styles from './sidebar.module.css' | ||
|
||
export default function Sidebar() { | ||
return ( | ||
<nav className={styles.nav}> | ||
<input className={styles.input} placeholder="Search..." /> | ||
<Link href="/"> | ||
<a>Home</a> | ||
</Link> | ||
<Link href="/about"> | ||
<a>About</a> | ||
</Link> | ||
<Link href="/contact"> | ||
<a>Contact</a> | ||
</Link> | ||
</nav> | ||
) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
.nav { | ||
height: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
width: 250px; | ||
background-color: #fafafa; | ||
padding: 32px; | ||
border-right: 1px solid #eaeaea; | ||
} | ||
|
||
.nav > a { | ||
margin: 8px 0; | ||
text-decoration: none; | ||
background: white; | ||
border-radius: 4px; | ||
font-size: 14px; | ||
padding: 12px 16px; | ||
text-transform: uppercase; | ||
font-weight: 600; | ||
letter-spacing: 0.025em; | ||
color: #333; | ||
border: 1px solid #eaeaea; | ||
transition: all 0.125s ease; | ||
} | ||
|
||
.nav > a:hover { | ||
background-color: #eaeaea; | ||
} | ||
|
||
.input { | ||
margin: 32px 0; | ||
text-decoration: none; | ||
background: white; | ||
border-radius: 4px; | ||
border: 1px solid #eaeaea; | ||
font-size: 14px; | ||
padding: 8px 16px; | ||
height: 28px; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#__next { | ||
display: flex; | ||
flex-direction: column; | ||
min-height: 100vh; | ||
} | ||
|
||
body { | ||
margin: 0; | ||
font-size: 24px; | ||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, | ||
Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import '../global.css' | ||
|
||
export default function MyApp({ Component, pageProps }) { | ||
// Use the layout defined at the page level, if available | ||
const getLayout = Component.getLayout || ((page) => page) | ||
|
||
return getLayout(<Component {...pageProps} />) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,40 @@ | ||
import Layout from '../components/layout' | ||
import Sidebar from '../components/sidebar' | ||
|
||
export default function About() { | ||
return ( | ||
<Layout title="About us"> | ||
<div>About us</div> | ||
</Layout> | ||
<section> | ||
<h2>Layout Example (About)</h2> | ||
<p> | ||
This example adds a property <code>getLayout</code> to your page, | ||
allowing you to return a React component for the layout. This allows you | ||
to define the layout on a per-page basis. Since we're returning a | ||
function, we can have complex nested layouts if desired. | ||
</p> | ||
<p> | ||
When navigating between pages, we want to persist page state (input | ||
values, scroll position, etc) for a Single-Page Application (SPA) | ||
experience. | ||
</p> | ||
<p> | ||
This layout pattern will allow for state persistence because the React | ||
component tree is persisted between page transitions. To preserve state, | ||
we need to prevent the React component tree from being discarded between | ||
page transitions. | ||
</p> | ||
<h3>Try It Out</h3> | ||
<p> | ||
To visualize this, try tying in the search input in the{' '} | ||
<code>Sidebar</code> and then changing routes. You'll notice the input | ||
state is persisted. | ||
</p> | ||
</section> | ||
) | ||
} | ||
|
||
About.getLayout = (page) => ( | ||
<Layout> | ||
<Sidebar /> | ||
{page} | ||
</Layout> | ||
) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,40 @@ | ||
import Layout from '../components/layout' | ||
import Sidebar from '../components/sidebar' | ||
|
||
export default function Contact() { | ||
return ( | ||
<Layout title="Contact us"> | ||
<div>Contact</div> | ||
</Layout> | ||
<section> | ||
<h2>Layout Example (Contact)</h2> | ||
<p> | ||
This example adds a property <code>getLayout</code> to your page, | ||
allowing you to return a React component for the layout. This allows you | ||
to define the layout on a per-page basis. Since we're returning a | ||
function, we can have complex nested layouts if desired. | ||
</p> | ||
<p> | ||
When navigating between pages, we want to persist page state (input | ||
values, scroll position, etc) for a Single-Page Application (SPA) | ||
experience. | ||
</p> | ||
<p> | ||
This layout pattern will allow for state persistence because the React | ||
component tree is persisted between page transitions. To preserve state, | ||
we need to prevent the React component tree from being discarded between | ||
page transitions. | ||
</p> | ||
<h3>Try It Out</h3> | ||
<p> | ||
To visualize this, try tying in the search input in the{' '} | ||
<code>Sidebar</code> and then changing routes. You'll notice the input | ||
state is persisted. | ||
</p> | ||
</section> | ||
) | ||
} | ||
|
||
Contact.getLayout = (page) => ( | ||
<Layout> | ||
<Sidebar /> | ||
{page} | ||
</Layout> | ||
) |
Oops, something went wrong.