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
Add React storybook #11
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
5eff6fc
yarn add -D @kadira/storybook
kenju a8c1e71
Add storybook config file and npm scripts to run storybook server
kenju 6d04aa9
Fix indent
kenju 54d0c85
Add story for react-simple-image
kenju 776a6e5
Tweak config
kenju 3ca58fb
Update npm scripts for storybook
kenju 0735215
Tweack sizes for story sample image
kenju 8fd2868
Add deploy script
kenju 2cbfafb
Fix deploy script
kenju 9e6ef62
Fix deploy script
kenju c52fa89
Remove deploy script
kenju File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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
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 |
---|---|---|
|
@@ -21,4 +21,4 @@ npm-debug.log | |
|
||
# app | ||
lib | ||
|
||
build |
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,7 @@ | ||
import { configure, addDecorator } from '@kadira/storybook'; | ||
|
||
function loadStories() { | ||
require('../stories/image.jsx'); | ||
} | ||
|
||
configure(loadStories, 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
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,49 @@ | ||
import React from 'react'; | ||
// eslint-disable-next-line import/no-extraneous-dependencies | ||
import { storiesOf } from '@kadira/storybook'; | ||
import Image from '../src/image'; | ||
import photo1x from './images/astronaut.jpg'; | ||
import photo2x from './images/astronaut@2x.jpg'; | ||
import photo300 from './images/react-300.png'; | ||
import photo900 from './images/react-900.png'; | ||
|
||
storiesOf('<Image />', module) | ||
.addDecorator(story => ( | ||
<div style={{ textAlign: 'center' }}> | ||
{story()} | ||
</div> | ||
)) | ||
.add('with pixel descriptor', () => ( | ||
<div> | ||
<Image | ||
alt="react-simple-image storybook component" | ||
src={photo1x} | ||
className="additional-className" | ||
srcSet={{ | ||
'1x': photo1x, | ||
'2x': photo2x, | ||
}} | ||
/> | ||
<p>License: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication</p> | ||
<p><a href="https://visualhunt.com/photo/15033/close-up-of-astronaut-in-space/">Visual Hunt</a></p> | ||
</div> | ||
)) | ||
.add('with width descriptor', () => ( | ||
<div> | ||
<Image | ||
alt="react-simple-image storybook component" | ||
src={photo300} | ||
className="additional-className" | ||
srcSet={{ | ||
'300w': photo300, | ||
'900w': photo900, | ||
}} | ||
sizes={[ | ||
{ size: '100vw', mediaCondition: '(max-width: 480px)' }, | ||
{ size: '50vw', mediaCondition: '(max-width: 1200px)' }, | ||
{ size: 'calc(33vw - 100px)' }, | ||
]} | ||
/> | ||
<p>License: <a href="https://facebook.github.io/react/">React</a></p> | ||
</div> | ||
)); |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
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.
なぜかVSCodeのESLint autosaveと相性が悪く、かつ体裁のルールなので、オフで問題ないと思い一旦オフにしてます 😓
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.
おや。これがあるとどうなります?
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.
↓これはESLint pluginのautosaveをONにした状態で「保存」を試している例なのですが、なぜかインデント戻ってしまうのです。autosaveをdisableにするか、ここのルールだけignoreするかで考えて、後者を選びました。
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.
なるほど。一旦disableしてしかるべきところに報告できるといいすな。
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.
はい。たぶんPlugin側かな... issues ないか見てみます。