-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Move LinkTo component to a separate addon-links/react
endpoint
#2239
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
88 changes: 88 additions & 0 deletions
88
examples/cra-kitchen-sink/src/stories/__snapshots__/addon-links.stories.storyshot
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,88 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Storyshots Addon Links.Button First 1`] = ` | ||
<button | ||
onClick={[Function]} | ||
> | ||
Go to "Second" | ||
</button> | ||
`; | ||
|
||
exports[`Storyshots Addon Links.Button Second 1`] = ` | ||
<button | ||
onClick={[Function]} | ||
> | ||
Go to "First" | ||
</button> | ||
`; | ||
|
||
exports[`Storyshots Addon Links.Href log 1`] = ` | ||
<span> | ||
See action logger | ||
</span> | ||
`; | ||
|
||
exports[`Storyshots Addon Links.Link First 1`] = ` | ||
<a | ||
href="/" | ||
onClick={[Function]} | ||
> | ||
Go to Second | ||
</a> | ||
`; | ||
|
||
exports[`Storyshots Addon Links.Link Second 1`] = ` | ||
<a | ||
href="/" | ||
onClick={[Function]} | ||
> | ||
Go to First | ||
</a> | ||
`; | ||
|
||
exports[`Storyshots Addon Links.Select First 1`] = ` | ||
<a | ||
href="/" | ||
onClick={[Function]} | ||
> | ||
Go back | ||
</a> | ||
`; | ||
|
||
exports[`Storyshots Addon Links.Select Index 1`] = ` | ||
<select | ||
onChange={[Function]} | ||
value="Index" | ||
> | ||
<option> | ||
Index | ||
</option> | ||
<option> | ||
First | ||
</option> | ||
<option> | ||
Second | ||
</option> | ||
<option> | ||
Third | ||
</option> | ||
</select> | ||
`; | ||
|
||
exports[`Storyshots Addon Links.Select Second 1`] = ` | ||
<a | ||
href="/" | ||
onClick={[Function]} | ||
> | ||
Go back | ||
</a> | ||
`; | ||
|
||
exports[`Storyshots Addon Links.Select Third 1`] = ` | ||
<a | ||
href="/" | ||
onClick={[Function]} | ||
> | ||
Go back | ||
</a> | ||
`; |
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" />); | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
do we need to update these in the cli templates?
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.
This was already updated in #1829. Actually I just did some copy-pasting from commented code in
stories/index.js
to partially restore therelease/3.3
changes.If you feel like it, you can sync the rest of the changes in another PR
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.
Why does this need to change?
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.
It has changed in #1829 not now. It’basically adding a usage of a new feature
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.
Ok, well I'm OK with this change.