Skip to content

Commit

Permalink
feat(buttons): add storybook for input type file
Browse files Browse the repository at this point in the history
  • Loading branch information
guastallaigor committed Oct 17, 2019
1 parent eef4699 commit 09e538b
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 09e538b

Please sign in to comment.