-
-
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.
Addon-docs: Convert repo stories to new module format (#7175)
Addon-docs: Convert repo stories to new module format
- Loading branch information
Showing
198 changed files
with
6,269 additions
and
3,989 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,5 @@ export { | |
getStorybook, | ||
forceReRender, | ||
raw, | ||
load, | ||
} from './preview'; |
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,8 +1,15 @@ | ||
// FIXME: svgr issue @igor-dv | ||
|
||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
|
||
import App from '../App'; | ||
|
||
storiesOf('App', module).add('full app', () => <App />); | ||
export default { | ||
title: 'App', | ||
}; | ||
|
||
export const fullApp = () => <App />; | ||
|
||
fullApp.story = { | ||
name: 'full app', | ||
}; |
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,5 +1,8 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import LifecycleLogger from '../components/LifecycleLogger'; | ||
|
||
storiesOf('Lifecycle', module).add('logging', () => <LifecycleLogger />); | ||
export default { | ||
title: 'Lifecycle', | ||
}; | ||
|
||
export const logging = () => <LifecycleLogger />; |
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
10 changes: 7 additions & 3 deletions
10
examples/cra-kitchen-sink/src/stories/force-rerender.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 |
---|---|---|
@@ -1,14 +1,18 @@ | ||
import React from 'react'; | ||
import { storiesOf, forceReRender } from '@storybook/react'; | ||
import { forceReRender } from '@storybook/react'; | ||
|
||
let count = 0; | ||
const increment = () => { | ||
count += 1; | ||
forceReRender(); | ||
}; | ||
|
||
storiesOf('Force ReRender', module).add('button', () => ( | ||
export default { | ||
title: 'Force ReRender', | ||
}; | ||
|
||
export const button = () => ( | ||
<button type="button" onClick={increment}> | ||
Click me to increment: {count} | ||
</button> | ||
)); | ||
); |
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: 7 additions & 4 deletions
11
examples/cra-kitchen-sink/src/stories/long-description.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 |
---|---|---|
@@ -1,9 +1,12 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { action } from '@storybook/addon-actions'; | ||
import centered from '@storybook/addon-centered/react'; | ||
import { Button } from '@storybook/react/demo'; | ||
|
||
storiesOf('Some really long story kind description', module) | ||
.addDecorator(centered) | ||
.add('with text', () => <Button onClick={action('clicked')}>Hello Button</Button>); | ||
export default { | ||
title: 'Some really long story kind description', | ||
decorators: [centered], | ||
}; | ||
|
||
export const story1 = () => <Button onClick={action('clicked')}>Hello Button</Button>; | ||
story1.story = { name: 'with text' }; |
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,10 +1,14 @@ | ||
import React from 'react'; | ||
import { Welcome } from '@storybook/react/demo'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { linkTo } from '@storybook/addon-links'; | ||
|
||
storiesOf('Welcome', module) | ||
.addParameters({ | ||
export default { | ||
title: 'Welcome', | ||
|
||
parameters: { | ||
component: Welcome, | ||
}) | ||
.add('to Storybook', () => <Welcome showApp={linkTo('Button')} />); | ||
}, | ||
}; | ||
|
||
export const story1 = () => <Welcome showApp={linkTo('Button')} />; | ||
story1.title = 'to Storybook'; |
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,14 +1,10 @@ | ||
import { configure, addParameters } from '@storybook/react'; | ||
import { load, addParameters } from '@storybook/react'; | ||
import { create } from '@storybook/theming/create'; | ||
|
||
function loadStories() { | ||
require('../src/stories'); | ||
} | ||
|
||
addParameters({ | ||
options: { | ||
theme: create({ colorPrimary: 'hotpink', colorSecondary: 'orangered' }), | ||
}, | ||
}); | ||
|
||
configure(loadStories, module); | ||
load(require.context('../src/stories', true, /\.stories\.js$/), module); |
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,22 @@ | ||
import React from 'react'; | ||
import { action } from '@storybook/addon-actions'; | ||
import { Button } from '@storybook/react/demo'; | ||
|
||
export default { | ||
title: 'Button', | ||
parameters: { | ||
component: Button, | ||
}, | ||
}; | ||
|
||
export const story1 = () => <Button onClick={action('clicked')}>Hello Button</Button>; | ||
story1.story = { name: 'with text' }; | ||
|
||
export const story2 = () => ( | ||
<Button onClick={action('clicked')}> | ||
<span role="img" aria-label="so cool"> | ||
😀 😎 👍 💯 | ||
</span> | ||
</Button> | ||
); | ||
story2.story = { name: 'with some emoji' }; |
This file was deleted.
Oops, something went wrong.
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,13 @@ | ||
import React from 'react'; | ||
import { linkTo } from '@storybook/addon-links'; | ||
import { Welcome } from '@storybook/react/demo'; | ||
|
||
export default { | ||
title: 'Welcome', | ||
parameters: { | ||
component: Welcome, | ||
}, | ||
}; | ||
|
||
export const story1 = () => <Welcome showApp={linkTo('Button')} />; | ||
story1.story = { name: 'to Storybook' }; |
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
Oops, something went wrong.
e937c58
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 aliased the URL https://monorepo-lduay4xf9.now.sh to the following aliases.