-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(doc): update docs and stories from storybook (#679)
* feat(storybook): update parameters * feat(storybook): add code source addon * doc(Button): update Button doc and its stories * doc(storybook): remove deprecated addon * doc(Avatar): update doc and stories * doc(ButtonGroup): update doc and stories * doc(CheckBox): update doc and stories * doc(Counter): update doc and stories * doc(DatePicker): update doc and stories * doc(Dropdown): update doc and stories * doc(storybook): wrap stories for styling
- Loading branch information
Showing
28 changed files
with
804 additions
and
490 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import '@storybook/addon-knobs/register'; | ||
import '@storybook/addon-actions/register'; | ||
import '@storybook/addon-links/register'; | ||
import '@storybook/addon-options/register'; | ||
import '@storybook/addon-storysource/register'; | ||
import 'storybook-readme/register'; |
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,9 @@ | ||
module.exports = function({ config }) { | ||
config.module.rules.push({ | ||
test: /\.stories\.jsx?$/, | ||
loaders: [require.resolve('@storybook/addon-storysource/loader')], | ||
enforce: 'pre', | ||
}); | ||
|
||
return config; | ||
}; |
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,43 +1,68 @@ | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { withKnobs, text, select } from '@storybook/addon-knobs'; | ||
import { number, text, withKnobs } from '@storybook/addon-knobs'; | ||
|
||
import Wrapper from '../../Wrapper'; | ||
import { Avatar } from '../..'; | ||
import AvatarReadme from '../README.md'; | ||
|
||
storiesOf('Avatar', module) | ||
.addDecorator(withKnobs) | ||
.addParameters({ | ||
readme: { | ||
includePropTables: [Avatar], // won't work right now because of wrapped styled-comp https://github.com/tuchk4/storybook-readme/issues/177 | ||
// Show readme before story | ||
content: AvatarReadme, | ||
}, | ||
}) | ||
.add('default', () => { | ||
const name1 = text('Name 1', 'Thomas Roux', 'name'); | ||
const name2 = text('Name 2', 'Léopold Houdin', 'name'); | ||
const name3 = text('Name 3', 'Mickey Mouse', 'name'); | ||
.add('default with initials', () => { | ||
const name1 = text('Name 1', 'Thomas Roux', 'Props'); | ||
const name2 = text('Name 2', 'Léopold Houdin', 'Props'); | ||
const name3 = text('Name 3', 'Mickey Mouse', 'Props'); | ||
|
||
const size = number( | ||
'Size', | ||
3, | ||
{ | ||
range: true, | ||
min: 1.5, | ||
max: 10, | ||
step: 0.5, | ||
}, | ||
'Props', | ||
); | ||
|
||
return ( | ||
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 40px)' }}> | ||
<Avatar name={name1} /> | ||
<Avatar name={name2} /> | ||
<Avatar name={name3} /> | ||
</div> | ||
<Wrapper style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 120px)' }}> | ||
<Avatar name={name1} size={size} /> | ||
<Avatar name={name2} size={size} /> | ||
<Avatar name={name3} size={size} /> | ||
</Wrapper> | ||
); | ||
}) | ||
.add('with user image', () => { | ||
const name = text('Name', 'Tony Starck', 'name'); | ||
.add('with an user image', () => { | ||
const name = text('Name', 'Tony Starck', 'Props'); | ||
const imageUrl = text( | ||
'Image', | ||
'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR9urBbQTr7erOXvN978IfXd5TzG5KYU4BRwTfqixgTPodK32ewfg', | ||
'image', | ||
'Props', | ||
); | ||
|
||
const size = number( | ||
'Size', | ||
3, | ||
{ | ||
range: true, | ||
min: 1.5, | ||
max: 10, | ||
step: 0.5, | ||
}, | ||
'Props', | ||
); | ||
|
||
return ( | ||
<Wrapper> | ||
<Avatar name={name} src={imageUrl} size={size} /> | ||
</Wrapper> | ||
); | ||
const options = { | ||
medium: 1.5, | ||
big: 3.1, | ||
huge: 4.1, | ||
}; | ||
const size = select('Size', options, 3.1, 'size'); | ||
return <Avatar name={name} src={imageUrl} size={size} />; | ||
}); |
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
Oops, something went wrong.