/
examples.js
55 lines (49 loc) · 1.14 KB
/
examples.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import Vue from 'vue'
import { Button } from 'evergarden'
import { addDecorator } from '@storybook/vue'
import { action } from '@storybook/addon-actions'
import { withKnobs, text, select, boolean } from '@storybook/addon-knobs'
addDecorator(withKnobs)
const variantColors = {
label: 'Variants',
options: ['green', 'red', 'cyan', 'orange', 'blue'],
defaultValue: 'green'
}
const sizes = {
label: 'Sizes',
options: ['xs', 'sm', 'md', 'lg'],
defaultValue: 'md'
}
export default { title: 'Button' }
export const basic = () => ({
props: {
variantColor: {
default: select(
variantColors.label,
variantColors.options,
variantColors.defaultValue
)
},
size: {
default: select(sizes.label, sizes.options, sizes.defaultValue)
},
text: {
default: text('Button text', 'Click me!')
},
disabled: {
default: boolean('Disabled', false)
}
},
render(h) {
return (
<Button
variantColor={this.variantColor}
size={this.size}
isDisabled={this.disabled}
onClick={action('hello')}
>
{this.text}
</Button>
)
}
})