-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDX: Better ergonomics for documenting CSF (#8312)
MDX: Better ergonomics for documenting CSF
- Loading branch information
Showing
8 changed files
with
147 additions
and
47 deletions.
There are no files selected for viewing
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
11 changes: 11 additions & 0 deletions
11
addons/docs/src/mdx/__testfixtures__/story-function-var.mdx
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,11 @@ | ||
import { Meta, Story } from '@storybook/addon-docs/blocks'; | ||
|
||
<Meta title="story-function-var" /> | ||
|
||
export const basicFn = () => <Button />; | ||
|
||
# Button | ||
|
||
I can define a story with the function defined in CSF: | ||
|
||
<Story name="basic">{basicFn}</Story> |
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
11 changes: 11 additions & 0 deletions
11
examples/official-storybook/stories/addon-docs/csf-with-mdx-docs.stories.js
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,11 @@ | ||
import React from 'react'; | ||
import { Button } from '@storybook/react/demo'; | ||
|
||
export default { | ||
title: 'Addons|Docs/csf-with-mdx-docs', | ||
component: Button, | ||
includeStories: [], // or simply don't load this file at all | ||
}; | ||
|
||
// eslint-disable-next-line react/prop-types | ||
export const basic = ({ parameters }) => <Button>Basic</Button>; |
10 changes: 10 additions & 0 deletions
10
examples/official-storybook/stories/addon-docs/csf-with-mdx-docs.stories.mdx
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,10 @@ | ||
import { Meta, Story } from '@storybook/addon-docs/blocks'; | ||
import * as stories from './csf-with-mdx-docs.stories'; | ||
|
||
<Meta title="Addons|Docs/csf-with-mdx-docs" /> | ||
|
||
# Button | ||
|
||
I can define a story with the function imported from CSF: | ||
|
||
<Story name="basic">{stories.basic}</Story> |
7d0123b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to following URLs: