open-nomad/ui/stories/components/stepper-input.stories.js

49 lines
1 KiB
JavaScript
Raw Normal View History

2020-06-18 20:19:58 +00:00
import hbs from 'htmlbars-inline-precompile';
2020-06-19 03:13:36 +00:00
import { withKnobs, optionsKnob } from '@storybook/addon-knobs';
2020-06-18 20:19:58 +00:00
export default {
title: 'Components|Stepper Input',
2020-06-19 03:13:36 +00:00
decorators: [withKnobs],
2020-06-18 20:19:58 +00:00
};
2020-06-19 03:13:36 +00:00
const variantKnob = () =>
optionsKnob(
'Variant',
{
Primary: 'is-primary',
Info: 'is-info',
Warning: 'is-warning',
Danger: 'is-danger',
},
'is-primary',
{
display: 'inline-radio',
},
'variant-id'
);
2020-06-18 20:19:58 +00:00
export let Standard = () => {
return {
template: hbs`
<p class="mock-spacing">
<StepperInput
@value={{value}}
@min={{min}}
@max={{max}}
2020-06-19 03:13:36 +00:00
@class={{variant}}
2020-06-18 20:19:58 +00:00
@onChange={{action (mut value)}}>
Stepper
</StepperInput>
2020-06-19 03:13:36 +00:00
<button class="button is-info">Button for Context</button>
2020-06-18 20:19:58 +00:00
</p>
<p class="mock-spacing"><strong>External Value:</strong> {{value}}</p>
`,
context: {
min: 0,
max: 10,
value: 5,
2020-06-19 03:13:36 +00:00
variant: variantKnob(),
2020-06-18 20:19:58 +00:00
},
};
};