+ Additionally, the Storybook demo components are moved into the
+ components directory and their css is refactored into component level
+ Styled JSX + SCSS.
+
+
+ You'll also notice that the main .babelrc config is used directly in
+ Storybook (possibly Storybook can just be pointed at the main .babelrc
+ file to remove the duplication).
+
+
+ Story files live in their own directory and refer to the components
+ within /components.
+
+
+ The /styles directory contains styles, both global and for the
+ index.js file.
+
+ We recommend building UIs with a{' '}
+
+ component-driven
+ {' '}
+ process starting with atomic components and ending with pages.
+
+
+ Render pages with mock data. This makes it easy to build and review
+ page states without needing to navigate to them in your app. Here are
+ some handy patterns for managing page data in Storybook:
+
+
+
+ Use a higher-level connected component. Storybook helps you compose
+ such data from the "args" of child component stories
+
+
+ Assemble data in the page component from your services. You can mock
+ these services out using Storybook.
+
+
+
+ Get a guided tutorial on component-driven development at{' '}
+
+ Learn Storybook
+
+ . Read more in the{' '}
+
+ docs
+
+ .
+
+
+ Tip Adjust the width of the canvas with
+ the{' '}
+
+ Viewports addon in the toolbar (when viewed in Storybook)
+
+
+ Create Next App
+
+
+
+ {/* Including demo props here for example */}
+
+
+
+
+ )
+}
diff --git a/examples/with-storybook-styled-jsx-scss/public/favicon.ico b/examples/with-storybook-styled-jsx-scss/public/favicon.ico
new file mode 100644
index 0000000000000000000000000000000000000000..4965832f2c9b0605eaa189b7c7fb11124d24e48a
GIT binary patch
literal 15086
zcmeHOOH5Q(7(R0cc?bh2AT>N@1PWL!LLfZKyG5c!MTHoP7_p!sBz0k$?pjS;^lmgJ
zU6^i~bWuZYHL)9$wuvEKm~qo~(5=Lvx5&Hv;?X#m}i|`yaGY4gX+&b>tew;gcnRQA1kp
zBbm04SRuuE{Hn+&1wk%&g;?wja_Is#1gKoFlI7f`Gt}X*-nsMO30b_J@)EFNhzd1QM
zdH&qFb9PVqQOx@clvc#KAu}^GrN`q5oP(8>m4UOcp`k&xwzkTio*p?kI4BPtIwX%B
zJN69cGsm=x90<;Wmh-bs>43F}ro$}Of@8)4KHndLiR$nW?*{Rl72JPUqRr3ta6e#A
z%DTEbi9N}+xPtd1juj8;(CJt3r9NOgb>KTuK|z7!JB_KsFW3(pBN4oh&M&}Nb$Ee2
z$-arA6a)CdsPj`M#1DS>fqj#KF%0q?w50GN4YbmMZIoF{e1yTR=4ablqXHBB2!`wM
z1M1ke9+<);|AI;f=2^F1;G6Wfpql?1d5D4rMr?#f(=hkoH)U`6Gb)#xDLjoKjp)1;Js@2Iy5yk
zMXUqj+gyk1i0yLjWS|3sM2-1ECc;MAz<4t0P53%7se$$+5Ex`L5TQO_MMXXi04UDIU+3*7Ez&X|mj9cFYBXqM{M;mw_
zpw>azP*qjMyNSD4hh)XZt$gqf8f?eRSFX8VQ4Y+H3jAtvyTrXr`qHAD6`m;aYmH2zOhJC~_*AuT}
zvUxC38|JYN94i(05R)dVKgUQF$}#cxV7xZ4FULqFCNX*Forhgp*yr6;DsIk=ub0Hv
zpk2L{9Q&|uI^b<6@i(Y+iSxeO_n**4nRLc`P!3ld5jL=nZRw6;DEJ*1z6Pvg+eW|$lnnjO
zjd|8>6l{i~UxI244CGn2kK@cJ|#ecwgSyt&HKA2)z
zrOO{op^o*-
+
+
\ No newline at end of file
diff --git a/examples/with-storybook-styled-jsx-scss/stories/Button.stories.tsx b/examples/with-storybook-styled-jsx-scss/stories/Button.stories.tsx
new file mode 100644
index 0000000000000..3a6504b17d2cb
--- /dev/null
+++ b/examples/with-storybook-styled-jsx-scss/stories/Button.stories.tsx
@@ -0,0 +1,38 @@
+import React from 'react'
+// also exported from '@storybook/react' if you can deal with breaking changes in 6.1
+import { Story, Meta } from '@storybook/react/types-6-0'
+
+import { Button, ButtonProps } from '../components/Button'
+
+export default {
+ title: 'Example/Button',
+ component: Button,
+ argTypes: {
+ backgroundColor: { control: 'color' },
+ },
+} as Meta
+
+const Template: Story = (args) =>
+
+export const Primary = Template.bind({})
+Primary.args = {
+ primary: true,
+ label: 'Button',
+}
+
+export const Secondary = Template.bind({})
+Secondary.args = {
+ label: 'Button',
+}
+
+export const Large = Template.bind({})
+Large.args = {
+ size: 'large',
+ label: 'Button',
+}
+
+export const Small = Template.bind({})
+Small.args = {
+ size: 'small',
+ label: 'Button',
+}
diff --git a/examples/with-storybook-styled-jsx-scss/stories/Header.stories.tsx b/examples/with-storybook-styled-jsx-scss/stories/Header.stories.tsx
new file mode 100644
index 0000000000000..1c0b98beb8fa5
--- /dev/null
+++ b/examples/with-storybook-styled-jsx-scss/stories/Header.stories.tsx
@@ -0,0 +1,20 @@
+import React from 'react'
+// also exported from '@storybook/react' if you can deal with breaking changes in 6.1
+import { Story, Meta } from '@storybook/react/types-6-0'
+
+import { Header, HeaderProps } from '../components/Header'
+
+export default {
+ title: 'Example/Header',
+ component: Header,
+} as Meta
+
+const Template: Story = (args) =>
+
+export const LoggedIn = Template.bind({})
+LoggedIn.args = {
+ user: {},
+}
+
+export const LoggedOut = Template.bind({})
+LoggedOut.args = {}
diff --git a/examples/with-storybook-styled-jsx-scss/stories/Introduction.stories.mdx b/examples/with-storybook-styled-jsx-scss/stories/Introduction.stories.mdx
new file mode 100644
index 0000000000000..deb3fa7da9ac0
--- /dev/null
+++ b/examples/with-storybook-styled-jsx-scss/stories/Introduction.stories.mdx
@@ -0,0 +1,219 @@
+import { Meta } from '@storybook/addon-docs/blocks'
+import Code from './assets/code-brackets.svg'
+import Colors from './assets/colors.svg'
+import Comments from './assets/comments.svg'
+import Direction from './assets/direction.svg'
+import Flow from './assets/flow.svg'
+import Plugin from './assets/plugin.svg'
+import Repo from './assets/repo.svg'
+import StackAlt from './assets/stackalt.svg'
+
+
+
+
+
+# Welcome to Storybook
+
+Storybook helps you build UI components in isolation from your app's business logic, data, and context.
+That makes it easy to develop hard-to-reach states. Save these UI states as **stories** to revisit during development, testing, or QA.
+
+Browse example stories now by navigating to them in the sidebar.
+View their code in the `src/storybook-examples` directory to learn how they work.
+We recommend building UIs with a [**component-driven**](https://componentdriven.org) process starting with atomic components and ending with pages.
+
+
+ TipEdit the Markdown in{' '}
+ src/storybook-examples/welcome.mdx
+
diff --git a/examples/with-storybook-styled-jsx-scss/stories/Page.stories.tsx b/examples/with-storybook-styled-jsx-scss/stories/Page.stories.tsx
new file mode 100644
index 0000000000000..222a82a82801c
--- /dev/null
+++ b/examples/with-storybook-styled-jsx-scss/stories/Page.stories.tsx
@@ -0,0 +1,23 @@
+import React from 'react'
+// also exported from '@storybook/react' if you can deal with breaking changes in 6.1
+import { Story, Meta } from '@storybook/react/types-6-0'
+
+import { Page, PageProps } from '../components/Page'
+import * as HeaderStories from './Header.stories'
+
+export default {
+ title: 'Example/Page',
+ component: Page,
+} as Meta
+
+const Template: Story = (args) =>
+
+export const LoggedIn = Template.bind({})
+LoggedIn.args = {
+ ...HeaderStories.LoggedIn.args,
+}
+
+export const LoggedOut = Template.bind({})
+LoggedOut.args = {
+ ...HeaderStories.LoggedOut.args,
+}
diff --git a/examples/with-storybook-styled-jsx-scss/stories/assets/code-brackets.svg b/examples/with-storybook-styled-jsx-scss/stories/assets/code-brackets.svg
new file mode 100644
index 0000000000000..73de947760010
--- /dev/null
+++ b/examples/with-storybook-styled-jsx-scss/stories/assets/code-brackets.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/examples/with-storybook-styled-jsx-scss/stories/assets/colors.svg b/examples/with-storybook-styled-jsx-scss/stories/assets/colors.svg
new file mode 100644
index 0000000000000..17d58d516e149
--- /dev/null
+++ b/examples/with-storybook-styled-jsx-scss/stories/assets/colors.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/examples/with-storybook-styled-jsx-scss/stories/assets/comments.svg b/examples/with-storybook-styled-jsx-scss/stories/assets/comments.svg
new file mode 100644
index 0000000000000..6493a139f523e
--- /dev/null
+++ b/examples/with-storybook-styled-jsx-scss/stories/assets/comments.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/examples/with-storybook-styled-jsx-scss/stories/assets/direction.svg b/examples/with-storybook-styled-jsx-scss/stories/assets/direction.svg
new file mode 100644
index 0000000000000..65676ac272294
--- /dev/null
+++ b/examples/with-storybook-styled-jsx-scss/stories/assets/direction.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/examples/with-storybook-styled-jsx-scss/stories/assets/flow.svg b/examples/with-storybook-styled-jsx-scss/stories/assets/flow.svg
new file mode 100644
index 0000000000000..8ac27db403c23
--- /dev/null
+++ b/examples/with-storybook-styled-jsx-scss/stories/assets/flow.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/examples/with-storybook-styled-jsx-scss/stories/assets/plugin.svg b/examples/with-storybook-styled-jsx-scss/stories/assets/plugin.svg
new file mode 100644
index 0000000000000..29e5c690c0a25
--- /dev/null
+++ b/examples/with-storybook-styled-jsx-scss/stories/assets/plugin.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/examples/with-storybook-styled-jsx-scss/stories/assets/repo.svg b/examples/with-storybook-styled-jsx-scss/stories/assets/repo.svg
new file mode 100644
index 0000000000000..f386ee902c1fe
--- /dev/null
+++ b/examples/with-storybook-styled-jsx-scss/stories/assets/repo.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/examples/with-storybook-styled-jsx-scss/stories/assets/stackalt.svg b/examples/with-storybook-styled-jsx-scss/stories/assets/stackalt.svg
new file mode 100644
index 0000000000000..9b7ad2743506e
--- /dev/null
+++ b/examples/with-storybook-styled-jsx-scss/stories/assets/stackalt.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/examples/with-storybook-styled-jsx-scss/styles/Home.module.css b/examples/with-storybook-styled-jsx-scss/styles/Home.module.css
new file mode 100644
index 0000000000000..b5307df0ade2f
--- /dev/null
+++ b/examples/with-storybook-styled-jsx-scss/styles/Home.module.css
@@ -0,0 +1,122 @@
+.container {
+ min-height: 100vh;
+ padding: 0 0.5rem;
+ display: flex;
+ flex-direction: column;
+ justify-content: left;
+ align-items: center;
+}
+
+.main {
+ padding: 5rem 0;
+ flex: 1;
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+}
+
+.footer {
+ width: 100%;
+ height: 100px;
+ border-top: 1px solid #eaeaea;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+}
+
+.footer img {
+ margin-left: 0.5rem;
+}
+
+.footer a {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+}
+
+.title a {
+ color: #0070f3;
+ text-decoration: none;
+}
+
+.title a:hover,
+.title a:focus,
+.title a:active {
+ text-decoration: underline;
+}
+
+.title {
+ margin: 0;
+ line-height: 1.15;
+ font-size: 4rem;
+}
+
+.title,
+.description {
+ text-align: center;
+}
+
+.description {
+ line-height: 1.5;
+ font-size: 1.5rem;
+}
+
+.code {
+ background: #fafafa;
+ border-radius: 5px;
+ padding: 0.75rem;
+ font-size: 1.1rem;
+ font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono,
+ Bitstream Vera Sans Mono, Courier New, monospace;
+}
+
+.grid {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ flex-wrap: wrap;
+ max-width: 800px;
+ margin-top: 3rem;
+}
+
+.card {
+ margin: 1rem;
+ flex-basis: 45%;
+ padding: 1.5rem;
+ text-align: left;
+ color: inherit;
+ text-decoration: none;
+ border: 1px solid #eaeaea;
+ border-radius: 10px;
+ transition: color 0.15s ease, border-color 0.15s ease;
+}
+
+.card:hover,
+.card:focus,
+.card:active {
+ color: #0070f3;
+ border-color: #0070f3;
+}
+
+.card h3 {
+ margin: 0 0 1rem 0;
+ font-size: 1.5rem;
+}
+
+.card p {
+ margin: 0;
+ font-size: 1.25rem;
+ line-height: 1.5;
+}
+
+.logo {
+ height: 1em;
+}
+
+@media (max-width: 600px) {
+ .grid {
+ width: 100%;
+ flex-direction: column;
+ }
+}
diff --git a/examples/with-storybook-styled-jsx-scss/styles/globals.css b/examples/with-storybook-styled-jsx-scss/styles/globals.css
new file mode 100644
index 0000000000000..e5e2dcc23baf1
--- /dev/null
+++ b/examples/with-storybook-styled-jsx-scss/styles/globals.css
@@ -0,0 +1,16 @@
+html,
+body {
+ padding: 0;
+ margin: 0;
+ font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
+ Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
+}
+
+a {
+ color: inherit;
+ text-decoration: none;
+}
+
+* {
+ box-sizing: border-box;
+}
diff --git a/examples/with-storybook-styled-jsx-scss/tsconfig.json b/examples/with-storybook-styled-jsx-scss/tsconfig.json
new file mode 100644
index 0000000000000..6871d95cb6ca2
--- /dev/null
+++ b/examples/with-storybook-styled-jsx-scss/tsconfig.json
@@ -0,0 +1,25 @@
+{
+ "compilerOptions": {
+ "target": "es5",
+ "lib": ["dom", "dom.iterable", "esnext"],
+ "allowJs": true,
+ "skipLibCheck": true,
+ "strict": true,
+ "forceConsistentCasingInFileNames": true,
+ "noEmit": true,
+ "esModuleInterop": true,
+ "module": "esnext",
+ "moduleResolution": "node",
+ "resolveJsonModule": true,
+ "isolatedModules": true,
+ "jsx": "preserve"
+ },
+ "include": [
+ "next-env.d.ts",
+ "**/*.ts",
+ "**/*.tsx",
+ ".storybook/Header.tsx",
+ ".storybook/Button.tsx"
+ ],
+ "exclude": ["node_modules"]
+}
From 1d0f727f6a24fe70245c6e8afead19f53260eedc Mon Sep 17 00:00:00 2001
From: Justin Philpott
Date: Sat, 31 Oct 2020 01:13:44 +0000
Subject: [PATCH 02/12] Add in missing newlines
---
examples/with-storybook-styled-jsx-scss/.babelrc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/examples/with-storybook-styled-jsx-scss/.babelrc b/examples/with-storybook-styled-jsx-scss/.babelrc
index e34ffc41292c3..3eaec7a8b8557 100644
--- a/examples/with-storybook-styled-jsx-scss/.babelrc
+++ b/examples/with-storybook-styled-jsx-scss/.babelrc
@@ -9,4 +9,4 @@
}
]
]
-}
\ No newline at end of file
+}
From ac876fe37b56220641c55ceadf340e43bed8d41a Mon Sep 17 00:00:00 2001
From: Justin Philpott
Date: Sat, 31 Oct 2020 01:14:57 +0000
Subject: [PATCH 03/12] Another missing newline
---
examples/with-storybook-styled-jsx-scss/.storybook/.babelrc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/examples/with-storybook-styled-jsx-scss/.storybook/.babelrc b/examples/with-storybook-styled-jsx-scss/.storybook/.babelrc
index e34ffc41292c3..3eaec7a8b8557 100644
--- a/examples/with-storybook-styled-jsx-scss/.storybook/.babelrc
+++ b/examples/with-storybook-styled-jsx-scss/.storybook/.babelrc
@@ -9,4 +9,4 @@
}
]
]
-}
\ No newline at end of file
+}
From 25df5738f3148a1abdd49cf151aeb488660b013e Mon Sep 17 00:00:00 2001
From: Justin Philpott
Date: Sat, 31 Oct 2020 01:26:11 +0000
Subject: [PATCH 04/12] Fix incorrect link in README
---
examples/with-storybook-styled-jsx-scss/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/examples/with-storybook-styled-jsx-scss/README.md b/examples/with-storybook-styled-jsx-scss/README.md
index 3ba07fa40ce8f..fb394f173522f 100644
--- a/examples/with-storybook-styled-jsx-scss/README.md
+++ b/examples/with-storybook-styled-jsx-scss/README.md
@@ -25,5 +25,5 @@ Deploy it to the cloud with [Vercel](https://vercel.com/import?filter=next.js&ut
This example combines the following examples, with some required extra config added:
- [with-storybook](https://github.com/vercel/next.js/tree/canary/examples/with-storybook)
-- [with-styled-jsx-scss](https://github.com/justinphilpott/next.js/tree/canary/examples/with-styled-jsx-scss)
+- [with-styled-jsx-scss](https://github.com/vercel/next.js/tree/canary/examples/with-styled-jsx-scss)
- [with-typescript](https://github.com/vercel/next.js/tree/canary/examples/with-typescript)
From 188eb85973b63e09569ec39e8783be8cee553a33 Mon Sep 17 00:00:00 2001
From: Justin Philpott
Date: Wed, 4 Nov 2020 18:52:23 +0000
Subject: [PATCH 05/12] Add newlines to eof for .svg files
---
.../stories/assets/code-brackets.svg | 2 +-
.../with-storybook-styled-jsx-scss/stories/assets/colors.svg | 2 +-
.../with-storybook-styled-jsx-scss/stories/assets/comments.svg | 2 +-
.../with-storybook-styled-jsx-scss/stories/assets/direction.svg | 2 +-
examples/with-storybook-styled-jsx-scss/stories/assets/flow.svg | 2 +-
.../with-storybook-styled-jsx-scss/stories/assets/plugin.svg | 2 +-
examples/with-storybook-styled-jsx-scss/stories/assets/repo.svg | 2 +-
.../with-storybook-styled-jsx-scss/stories/assets/stackalt.svg | 2 +-
8 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/examples/with-storybook-styled-jsx-scss/stories/assets/code-brackets.svg b/examples/with-storybook-styled-jsx-scss/stories/assets/code-brackets.svg
index 73de947760010..19c7826c8971c 100644
--- a/examples/with-storybook-styled-jsx-scss/stories/assets/code-brackets.svg
+++ b/examples/with-storybook-styled-jsx-scss/stories/assets/code-brackets.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
diff --git a/examples/with-storybook-styled-jsx-scss/stories/assets/colors.svg b/examples/with-storybook-styled-jsx-scss/stories/assets/colors.svg
index 17d58d516e149..bcfd399018fa8 100644
--- a/examples/with-storybook-styled-jsx-scss/stories/assets/colors.svg
+++ b/examples/with-storybook-styled-jsx-scss/stories/assets/colors.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
diff --git a/examples/with-storybook-styled-jsx-scss/stories/assets/comments.svg b/examples/with-storybook-styled-jsx-scss/stories/assets/comments.svg
index 6493a139f523e..be4f20a00e977 100644
--- a/examples/with-storybook-styled-jsx-scss/stories/assets/comments.svg
+++ b/examples/with-storybook-styled-jsx-scss/stories/assets/comments.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
diff --git a/examples/with-storybook-styled-jsx-scss/stories/assets/direction.svg b/examples/with-storybook-styled-jsx-scss/stories/assets/direction.svg
index 65676ac272294..933ab2443df91 100644
--- a/examples/with-storybook-styled-jsx-scss/stories/assets/direction.svg
+++ b/examples/with-storybook-styled-jsx-scss/stories/assets/direction.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
diff --git a/examples/with-storybook-styled-jsx-scss/stories/assets/flow.svg b/examples/with-storybook-styled-jsx-scss/stories/assets/flow.svg
index 8ac27db403c23..5467a7012e570 100644
--- a/examples/with-storybook-styled-jsx-scss/stories/assets/flow.svg
+++ b/examples/with-storybook-styled-jsx-scss/stories/assets/flow.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
diff --git a/examples/with-storybook-styled-jsx-scss/stories/assets/plugin.svg b/examples/with-storybook-styled-jsx-scss/stories/assets/plugin.svg
index 29e5c690c0a25..8bc9ca193e644 100644
--- a/examples/with-storybook-styled-jsx-scss/stories/assets/plugin.svg
+++ b/examples/with-storybook-styled-jsx-scss/stories/assets/plugin.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
diff --git a/examples/with-storybook-styled-jsx-scss/stories/assets/repo.svg b/examples/with-storybook-styled-jsx-scss/stories/assets/repo.svg
index f386ee902c1fe..a906e675b0625 100644
--- a/examples/with-storybook-styled-jsx-scss/stories/assets/repo.svg
+++ b/examples/with-storybook-styled-jsx-scss/stories/assets/repo.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
diff --git a/examples/with-storybook-styled-jsx-scss/stories/assets/stackalt.svg b/examples/with-storybook-styled-jsx-scss/stories/assets/stackalt.svg
index 9b7ad2743506e..7746eb31a68a0 100644
--- a/examples/with-storybook-styled-jsx-scss/stories/assets/stackalt.svg
+++ b/examples/with-storybook-styled-jsx-scss/stories/assets/stackalt.svg
@@ -1 +1 @@
-
\ No newline at end of file
+
From 17000253918096bb019173fea91d3f7ab42f9abc Mon Sep 17 00:00:00 2001
From: Luis Alvarez
Date: Fri, 11 Dec 2020 12:46:25 -0500
Subject: [PATCH 06/12] Updated with-storybook readme
---
examples/with-storybook/README.md | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/examples/with-storybook/README.md b/examples/with-storybook/README.md
index a1da101629a21..d51accb7ba7f5 100644
--- a/examples/with-storybook/README.md
+++ b/examples/with-storybook/README.md
@@ -6,6 +6,12 @@ This example shows a default set up of Storybook. Also included in the example i
As of v6.0, Storybook has built-in TypeScript support, so no configuration is needed. If you want to customize the default configuration, refer to the [TypeScript docs](https://storybook.js.org/docs/react/configure/typescript).
+## Deploy your own
+
+Deploy the example using [Vercel](https://vercel.com):
+
+[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/import/project?template=https://github.com/vercel/next.js/tree/canary/examples/with-storybook)
+
## How to use
Execute [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
@@ -16,7 +22,7 @@ npx create-next-app --example with-storybook with-storybook-app
yarn create next-app --example with-storybook with-storybook-app
```
-## Run Storybook
+### Run Storybook
```bash
npm run storybook
@@ -24,7 +30,7 @@ npm run storybook
yarn storybook
```
-## Build Static Storybook
+### Build Static Storybook
```bash
npm run build-storybook
From e9debaa59c55f964efe26c293e000f3cd1567868 Mon Sep 17 00:00:00 2001
From: Luis Alvarez
Date: Fri, 11 Dec 2020 12:47:25 -0500
Subject: [PATCH 07/12] Updated gitignore
---
examples/with-storybook-styled-jsx-scss/.gitignore | 3 +++
examples/with-storybook/.gitignore | 3 +++
2 files changed, 6 insertions(+)
diff --git a/examples/with-storybook-styled-jsx-scss/.gitignore b/examples/with-storybook-styled-jsx-scss/.gitignore
index 1437c53f70bc2..a423604f97788 100644
--- a/examples/with-storybook-styled-jsx-scss/.gitignore
+++ b/examples/with-storybook-styled-jsx-scss/.gitignore
@@ -32,3 +32,6 @@ yarn-error.log*
# vercel
.vercel
+
+# Storybook
+/storybook-static
\ No newline at end of file
diff --git a/examples/with-storybook/.gitignore b/examples/with-storybook/.gitignore
index 1437c53f70bc2..a423604f97788 100644
--- a/examples/with-storybook/.gitignore
+++ b/examples/with-storybook/.gitignore
@@ -32,3 +32,6 @@ yarn-error.log*
# vercel
.vercel
+
+# Storybook
+/storybook-static
\ No newline at end of file
From 3e35819893a5c046bfa343297e9c9155f939631f Mon Sep 17 00:00:00 2001
From: Luis Alvarez
Date: Fri, 11 Dec 2020 12:48:31 -0500
Subject: [PATCH 08/12] Updated readme to mention Storybook steps
---
.../with-storybook-styled-jsx-scss/README.md | 20 +++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/examples/with-storybook-styled-jsx-scss/README.md b/examples/with-storybook-styled-jsx-scss/README.md
index fb394f173522f..c35210600ec7e 100644
--- a/examples/with-storybook-styled-jsx-scss/README.md
+++ b/examples/with-storybook-styled-jsx-scss/README.md
@@ -4,7 +4,7 @@ This example shows Styled-jsx (with SCSS) working for components written in Type
## Deploy your own
-Deploy the example using [Vercel](https://vercel.com/now):
+Deploy the example using [Vercel](https://vercel.com):
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/import/project?template=https://github.com/vercel/next.js/tree/canary/examples/with-storybook-styled-jsx-scss)
@@ -18,7 +18,23 @@ npx create-next-app --example with-storybook-styled-jsx-scss with-storybook-styl
yarn create next-app --example with-storybook-styled-jsx-scss with-storybook-styled-jsx-scss-app
```
-Deploy it to the cloud with [Vercel](https://vercel.com/import?filter=next.js&utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).
+### Run Storybook
+
+```bash
+npm run storybook
+# or
+yarn storybook
+```
+
+### Build Static Storybook
+
+```bash
+npm run build-storybook
+# or
+yarn build-storybook
+```
+
+You can use [Vercel](https://vercel.com/import?filter=next.js&utm_source=github&utm_medium=readme&utm_campaign=next-example) to deploy Storybook. Specify `storybook-static` as the output directory.
## Notes
From 73b27b2e0ec6311d9c6bccee328e57f7a57d96cd Mon Sep 17 00:00:00 2001
From: Luis Alvarez
Date: Fri, 11 Dec 2020 12:48:45 -0500
Subject: [PATCH 09/12] Moved _app.js to TS
---
.../with-storybook-styled-jsx-scss/pages/{_app.js => _app.tsx} | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
rename examples/with-storybook-styled-jsx-scss/pages/{_app.js => _app.tsx} (51%)
diff --git a/examples/with-storybook-styled-jsx-scss/pages/_app.js b/examples/with-storybook-styled-jsx-scss/pages/_app.tsx
similarity index 51%
rename from examples/with-storybook-styled-jsx-scss/pages/_app.js
rename to examples/with-storybook-styled-jsx-scss/pages/_app.tsx
index 1e1cec92425c8..27cd5bfc2166f 100644
--- a/examples/with-storybook-styled-jsx-scss/pages/_app.js
+++ b/examples/with-storybook-styled-jsx-scss/pages/_app.tsx
@@ -1,6 +1,7 @@
+import { AppProps } from 'next/app'
import '../styles/globals.css'
-function MyApp({ Component, pageProps }) {
+function MyApp({ Component, pageProps }: AppProps) {
return
}
From 047b29a18afbfa427df18a3422fa8201589bfd21 Mon Sep 17 00:00:00 2001
From: Luis Alvarez
Date: Fri, 11 Dec 2020 13:15:25 -0500
Subject: [PATCH 10/12] Remove .babelrc
---
.../.storybook/.babelrc | 12 ------------
1 file changed, 12 deletions(-)
delete mode 100644 examples/with-storybook-styled-jsx-scss/.storybook/.babelrc
diff --git a/examples/with-storybook-styled-jsx-scss/.storybook/.babelrc b/examples/with-storybook-styled-jsx-scss/.storybook/.babelrc
deleted file mode 100644
index 3eaec7a8b8557..0000000000000
--- a/examples/with-storybook-styled-jsx-scss/.storybook/.babelrc
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "presets": [
- [
- "next/babel",
- {
- "styled-jsx": {
- "plugins": ["styled-jsx-plugin-sass"]
- }
- }
- ]
- ]
-}
From a36cab17ee6d37f27018070791b973c75f9eba69 Mon Sep 17 00:00:00 2001
From: Justin Philpott
Date: Sat, 12 Dec 2020 14:39:39 +0000
Subject: [PATCH 11/12] Update storybook and remove unwanted tsconf includes
---
examples/with-storybook-styled-jsx-scss/package.json | 8 ++++----
examples/with-storybook-styled-jsx-scss/tsconfig.json | 8 +-------
2 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/examples/with-storybook-styled-jsx-scss/package.json b/examples/with-storybook-styled-jsx-scss/package.json
index 4f0bb8af8e17b..0a85565d4b3ce 100644
--- a/examples/with-storybook-styled-jsx-scss/package.json
+++ b/examples/with-storybook-styled-jsx-scss/package.json
@@ -19,10 +19,10 @@
"license": "MIT",
"devDependencies": {
"@babel/core": "^7.12.3",
- "@storybook/addon-actions": "^6.0.28",
- "@storybook/addon-essentials": "^6.0.28",
- "@storybook/addon-links": "^6.0.28",
- "@storybook/react": "^6.0.28",
+ "@storybook/addon-actions": "^6.1.11",
+ "@storybook/addon-essentials": "^6.1.11",
+ "@storybook/addon-links": "^6.1.11",
+ "@storybook/react": "^6.1.11",
"@types/node": "^14.14.2",
"@types/react": "^16.9.53",
"@types/react-dom": "^16.9.8",
diff --git a/examples/with-storybook-styled-jsx-scss/tsconfig.json b/examples/with-storybook-styled-jsx-scss/tsconfig.json
index 6871d95cb6ca2..4fa631c261428 100644
--- a/examples/with-storybook-styled-jsx-scss/tsconfig.json
+++ b/examples/with-storybook-styled-jsx-scss/tsconfig.json
@@ -14,12 +14,6 @@
"isolatedModules": true,
"jsx": "preserve"
},
- "include": [
- "next-env.d.ts",
- "**/*.ts",
- "**/*.tsx",
- ".storybook/Header.tsx",
- ".storybook/Button.tsx"
- ],
+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}
From 1c014c939228dd25117cf30645bcce4ea595062c Mon Sep 17 00:00:00 2001
From: Justin Philpott
Date: Tue, 15 Dec 2020 13:31:32 +0000
Subject: [PATCH 12/12] Update description in page.tsx
---
examples/with-storybook-styled-jsx-scss/components/Page.tsx | 5 -----
1 file changed, 5 deletions(-)
diff --git a/examples/with-storybook-styled-jsx-scss/components/Page.tsx b/examples/with-storybook-styled-jsx-scss/components/Page.tsx
index 606ed79db8467..d99229dc66ddb 100644
--- a/examples/with-storybook-styled-jsx-scss/components/Page.tsx
+++ b/examples/with-storybook-styled-jsx-scss/components/Page.tsx
@@ -52,11 +52,6 @@ export const Page: React.FC = ({
components directory and their css is refactored into component level
Styled JSX + SCSS.
-
- You'll also notice that the main .babelrc config is used directly in
- Storybook (possibly Storybook can just be pointed at the main .babelrc
- file to remove the duplication).
-
Story files live in their own directory and refer to the components
within /components.