Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addon-docs: Add docs to standalone example #7848

Merged
merged 6 commits into from Jul 6, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/standalone-preview/package.json
Expand Up @@ -6,6 +6,7 @@
"storybook": "parcel ./storybook.html --port 1337"
},
"devDependencies": {
"@storybook/addon-docs": "6.0.0-beta.21",
"@storybook/react": "6.0.0-beta.21",
"parcel": "^1.12.3",
"react": "^16.8.4",
Expand Down
3 changes: 2 additions & 1 deletion examples/standalone-preview/storybook.html
Expand Up @@ -8,7 +8,8 @@
</head>
<body>
<div id="root"></div>
<script src="./storybook.ts"></script>
<div id="docs-root"></div>
<script src="./storybook.tsx"></script>
<div class="sb-errordisplay sb-wrapper">
<div id="error-message" class="sb-heading"></div>
<pre class="sb-errordisplay_code"><code id="error-stack"></code></pre>
Expand Down
16 changes: 16 additions & 0 deletions examples/standalone-preview/storybook.tsx
@@ -0,0 +1,16 @@
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', () => <div>Component 1 - Story 1</div>);

storiesOf('Component 2', module)
.add('Story 1', () => <div>Category 2 - Story 1</div>)
.add('Story 2', () => <div>Category 2 - Story 2</div>);
}, module);