From 8d620614c7aeb790ec7f4aad21844b0f0abbfd91 Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Fri, 23 Aug 2019 21:27:05 +0800 Subject: [PATCH 1/3] Addon-docs: Add docs to standalone example --- examples/standalone-preview/package.json | 1 + examples/standalone-preview/storybook.html | 1 + examples/standalone-preview/storybook.tsx | 8 +++++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/standalone-preview/package.json b/examples/standalone-preview/package.json index 9545a51ee50d..d755d489a9de 100644 --- a/examples/standalone-preview/package.json +++ b/examples/standalone-preview/package.json @@ -7,6 +7,7 @@ }, "devDependencies": { "@storybook/react": "5.2.0-beta.39", + "@storybook/addon-docs": "5.2.0-beta.39", "parcel": "^1.12.3", "react": "^16.8.4", "react-dom": "^16.8.4" diff --git a/examples/standalone-preview/storybook.html b/examples/standalone-preview/storybook.html index ee1a10affe69..ed566e7e2af9 100644 --- a/examples/standalone-preview/storybook.html +++ b/examples/standalone-preview/storybook.html @@ -8,6 +8,7 @@
+
diff --git a/examples/standalone-preview/storybook.tsx b/examples/standalone-preview/storybook.tsx index 8c0e649e1685..4d02fd13e1dc 100644 --- a/examples/standalone-preview/storybook.tsx +++ b/examples/standalone-preview/storybook.tsx @@ -1,5 +1,11 @@ import * as React from 'react'; -import { configure, storiesOf } from '@storybook/react'; +import { configure, storiesOf, addParameters } from '@storybook/react'; +import { DocsPage, DocsContainer } from '@storybook/addon-docs/blocks'; + +addParameters({ + docsContainer: DocsContainer, + docs: DocsPage, +}); configure(() => { storiesOf('Component 1', module).add('Story 1', () =>
Component 1 - Story 1
); From 7fc90b05eb92fe73a079551e6cf6b40ef3a7809f Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Tue, 6 Jul 2021 19:11:13 +0800 Subject: [PATCH 2/3] Update DocsPage demo to latest --- examples/standalone-preview/package.json | 1 + examples/standalone-preview/storybook.html | 2 +- examples/standalone-preview/storybook.ts | 11 ++++++++++- examples/standalone-preview/storybook.tsx | 16 ---------------- 4 files changed, 12 insertions(+), 18 deletions(-) delete mode 100644 examples/standalone-preview/storybook.tsx diff --git a/examples/standalone-preview/package.json b/examples/standalone-preview/package.json index 3f67f73c8cfe..36819a46d34a 100644 --- a/examples/standalone-preview/package.json +++ b/examples/standalone-preview/package.json @@ -6,6 +6,7 @@ "storybook": "parcel ./storybook.html --port 1337" }, "devDependencies": { + "@storybook/addon-docs": "6.4.0-alpha.11", "@storybook/react": "6.4.0-alpha.11", "parcel": "^1.12.4", "react": "16.14.0", diff --git a/examples/standalone-preview/storybook.html b/examples/standalone-preview/storybook.html index ed566e7e2af9..834cd2e00ca0 100644 --- a/examples/standalone-preview/storybook.html +++ b/examples/standalone-preview/storybook.html @@ -9,7 +9,7 @@
- +
diff --git a/examples/standalone-preview/storybook.ts b/examples/standalone-preview/storybook.ts index 6480e83e1f2d..b218ec5b6f50 100644 --- a/examples/standalone-preview/storybook.ts +++ b/examples/standalone-preview/storybook.ts @@ -1,5 +1,14 @@ -import { configure } from '@storybook/react'; +import { configure, addParameters } from '@storybook/react'; +import { DocsPage, DocsContainer } from '@storybook/addon-docs'; + import * as Comp1 from './stories/Component1.stories'; import * as Comp2 from './stories/Component2.stories'; +addParameters({ + docs: { + page: DocsPage, + container: DocsContainer, + }, +}); + configure(() => [Comp1, Comp2], module); diff --git a/examples/standalone-preview/storybook.tsx b/examples/standalone-preview/storybook.tsx deleted file mode 100644 index 4d02fd13e1dc..000000000000 --- a/examples/standalone-preview/storybook.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import * as React from 'react'; -import { configure, storiesOf, addParameters } from '@storybook/react'; -import { DocsPage, DocsContainer } from '@storybook/addon-docs/blocks'; - -addParameters({ - docsContainer: DocsContainer, - docs: DocsPage, -}); - -configure(() => { - storiesOf('Component 1', module).add('Story 1', () =>
Component 1 - Story 1
); - - storiesOf('Component 2', module) - .add('Story 1', () =>
Category 2 - Story 1
) - .add('Story 2', () =>
Category 2 - Story 2
); -}, module); From 45ddb57dea82bc397349ade248813afb3f72516f Mon Sep 17 00:00:00 2001 From: Michael Shilman Date: Tue, 6 Jul 2021 19:15:22 +0800 Subject: [PATCH 3/3] Update yarn.lock --- yarn.lock | 1 + 1 file changed, 1 insertion(+) diff --git a/yarn.lock b/yarn.lock index 15fb929546f2..414f52a0dcd3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -39619,6 +39619,7 @@ resolve@1.19.0: version: 0.0.0-use.local resolution: "standalone-preview@workspace:examples/standalone-preview" dependencies: + "@storybook/addon-docs": 6.4.0-alpha.11 "@storybook/react": 6.4.0-alpha.11 parcel: ^1.12.4 react: 16.14.0