Skip to content

Commit

Permalink
Merge pull request nostalgic-css#373 from nostalgic-css/add-type-file…
Browse files Browse the repository at this point in the history
…-story

feat(buttons): add storybook for input type file
  • Loading branch information
BcRikko authored Oct 17, 2019
2 parents eef4699 + 09e538b commit 95f0384
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions story/buttons.stories.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { storiesOf } from '@storybook/html'; // eslint-disable-line import/no-extraneous-dependencies
import { // eslint-disable-line import/no-extraneous-dependencies
withKnobs, radios,
withKnobs, radios, select,
} from '@storybook/addon-knobs';

const stories = storiesOf('Buttons', module);
stories.addDecorator(withKnobs);

stories.add('button', () => {
const buttonType = select('type', {
button: 'button',
file: 'file',
}, 'button');
const extraClass = radios('class', {
default: '',
'is-primary': 'is-primary',
Expand All @@ -15,5 +19,10 @@ stories.add('button', () => {
'is-error': 'is-error',
'is-disabled': 'is-disabled',
}, '');
return `<button type="button" class="nes-btn ${extraClass}">Normal</button>`;
return buttonType === 'file'
? `<label class="nes-btn ${extraClass}">
<span>Select your file</span>
<input type="file">
</label>`
: `<button type="button" class="nes-btn ${extraClass}">Normal</button>`;
});

0 comments on commit 95f0384

Please sign in to comment.