Skip to content
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

refactor(storybook): storybook enhancement and cleanup #385

Merged
merged 1 commit into from
Dec 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 36 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 13 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"@storybook/html": "^5.0.0",
"autoprefixer": "^9.1.5",
"babel-loader": "^8.0.4",
"classnames": "^2.2.6",
"clean-css-cli": "^4.2.1",
"commitizen": "^3.1.1",
"css-loader": "^2.0.0",
Expand Down Expand Up @@ -158,7 +159,18 @@
]
},
"eslintConfig": {
"extends": "airbnb-base"
"extends": "airbnb-base",
"rules": {
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": [
"**/*.stories.js",
"**/*.template.js"
]
}
]
}
},
"eslintIgnore": [
"docs/*"
Expand Down
38 changes: 38 additions & 0 deletions story/_helpers/icons.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
export const Icons = {
twitter: 'twitter',
facebook: 'facebook',
github: 'github',
google: 'google',
youtube: 'youtube',
whatsapp: 'whatsapp',
gmail: 'gmail',
linkedin: 'linkedin',
instagram: 'instagram',
close: 'close',
coin: 'coin',
trophy: 'trophy',
};

export const Sprites = {
'nes-pokeball': 'nes-pokeball',
'nes-bulbasaur': 'nes-bulbasaur',
'nes-charmander': 'nes-charmander',
'nes-squirtle': 'nes-squirtle',
'nes-smartphone': 'nes-smartphone',
'nes-kirby': 'nes-kirby',
'nes-phone': 'nes-phone',
'nes-octocat animate': 'nes-octocat animate',
'nes-ash': 'nes-ash',
'nes-mario': 'nes-mario',
'nes-logo': 'nes-logo',
'nes-jp-logo': 'nes-jp-logo',
'snes-logo': 'snes-logo',
'snes-jp-logo': 'snes-jp-logo',
};

export const Size = {
default: '',
'is-small': 'is-small',
'is-medium': 'is-medium',
'is-large': 'is-large',
};
5 changes: 5 additions & 0 deletions story/_helpers/shared.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default {
'is-success': 'is-success',
'is-warning': 'is-warning',
'is-error': 'is-error',
};
22 changes: 0 additions & 22 deletions story/avatars.stories.js

This file was deleted.

8 changes: 8 additions & 0 deletions story/avatars/avatars.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { storiesOf } from '@storybook/html';
import { withKnobs } from '@storybook/addon-knobs';

import Avatars from './avatars.template';

storiesOf('Avatars', module)
.addDecorator(withKnobs)
.add('Avatar', () => Avatars());
26 changes: 26 additions & 0 deletions story/avatars/avatars.template.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { select, boolean } from '@storybook/addon-knobs';
import classNames from 'classnames';

export default () => {
const isRounded = boolean('is-rounded', false);
const avatarSize = select('Avatar Classes', {
default: '',
'is-small': 'is-small',
'is-medium': 'is-medium',
'is-large': 'is-large',
}, '');

const avatarClasses = classNames(
'nes-avatar',
avatarSize,
{
'is-rounded': isRounded,
},
);

return `
<img src="http://www.gravatar.com/avatar?s=15" class="${avatarClasses}"
alt="Gravatar Image Example"
style="image-rendering: pixelated;">
`;
};
43 changes: 0 additions & 43 deletions story/badge.stories.js

This file was deleted.

8 changes: 8 additions & 0 deletions story/badge/badge.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { storiesOf } from '@storybook/html';
import { withKnobs } from '@storybook/addon-knobs';

import Badge from './badge.template';

storiesOf('Badges', module)
.addDecorator(withKnobs)
.add('Badge', () => Badge());
Loading