Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from bitjourney/react-storybook
Add React storybook
- Loading branch information
Showing
12 changed files
with
2,152 additions
and
120 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 |
---|---|---|
|
@@ -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.