Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move LinkTo component to a separate
addon-links/react
endpoint
- Loading branch information
Showing
9 changed files
with
58 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('./dist/react'); |
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
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export default from './components/link'; |
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
36 changes: 36 additions & 0 deletions
36
examples/cra-kitchen-sink/src/stories/addon-links.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,36 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { linkTo, hrefTo } from '@storybook/addon-links'; | ||
import LinkTo from '@storybook/addon-links/react'; | ||
import { action } from '@storybook/addon-actions'; | ||
|
||
storiesOf('Addon Links.Link', module) | ||
.add('First', () => <LinkTo story="Second">Go to Second</LinkTo>) | ||
.add('Second', () => <LinkTo story="First">Go to First</LinkTo>); | ||
|
||
storiesOf('Addon Links.Button', module) | ||
.add('First', () => ( | ||
<button onClick={linkTo('Addon Links.Button', 'Second')}>Go to "Second"</button> | ||
)) | ||
.add('Second', () => ( | ||
<button onClick={linkTo('Addon Links.Button', 'First')}>Go to "First"</button> | ||
)); | ||
|
||
storiesOf('Addon Links.Select', module) | ||
.add('Index', () => ( | ||
<select value="Index" onChange={linkTo('Addon Links.Select', e => e.currentTarget.value)}> | ||
<option>Index</option> | ||
<option>First</option> | ||
<option>Second</option> | ||
<option>Third</option> | ||
</select> | ||
)) | ||
.add('First', () => <LinkTo story="Index">Go back</LinkTo>) | ||
.add('Second', () => <LinkTo story="Index">Go back</LinkTo>) | ||
.add('Third', () => <LinkTo story="Index">Go back</LinkTo>); | ||
|
||
storiesOf('Addon Links.Href', module).add('log', () => { | ||
hrefTo('Addon Links.Href', 'log').then(href => action('URL of this story')({ href })); | ||
|
||
return <span>See action logger</span>; | ||
}); |
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,6 +1,5 @@ | ||
import React from 'react'; | ||
import { Welcome } from '@storybook/react/demo'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { linkTo } from '@storybook/addon-links'; | ||
|
||
storiesOf('Welcome', module).add('to Storybook', () => <Welcome showApp={linkTo('Button')} />); | ||
storiesOf('Welcome', module).add('to Storybook', () => <Welcome showKind="Button" />); |