-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
120 lines (112 loc) · 2.84 KB
/
index.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
import { storiesOf } from '@storybook/vue'
import { action } from '@storybook/addon-actions'
import { linkTo } from '@storybook/addon-links'
// they work with Vue
import { withKnobs, text } from '@storybook/addon-knobs'
import { withNotes } from '@storybook/addon-notes'
// they do not work with Vue
import { withInfo } from '@storybook/addon-info'
import ButtonReadme from './README.md'
import withReadme from 'storybook-readme/with-readme'
import { setOptions } from '@storybook/addon-options';
setOptions({
/**
* name to display in the top left corner
* @type {String}
*/
name: 'Storybook XX',
/**
* URL for name in top left corner to link to
* @type {String}
*/
url: '#',
/**
* show story component as full screen
* @type {Boolean}
*/
goFullScreen: false,
/**
* display left panel that shows a list of stories
* @type {Boolean}
*/
showLeftPanel: true,
/**
* display horizontal panel that displays addon configurations
* @type {Boolean}
*/
showDownPanel: true,
/**
* display floating search box to search through stories
* @type {Boolean}
*/
showSearchBox: false,
/**
* show horizontal addons panel as a vertical panel on the right
* @type {Boolean}
*/
downPanelInRight: true,
/**
* sorts stories
* @type {Boolean}
*/
sortStoriesByKind: false,
/**
* regex for finding the hierarchy separator
* @example:
* null - turn off hierarchy
* /\// - split by `/`
* /\./ - split by `.`
* /\/|\./ - split by `/` or `.`
* @type {Regex}
*/
hierarchySeparator: null,
/**
* sidebar tree animations
* @type {Boolean}
*/
sidebarAnimations: true,
/**
* id to select an addon panel
* @type {String}
*/
selectedAddonPanel: undefined, // The order of addons in the "Addons Panel" is the same as you import them in 'addons.js'. The first panel will be opened by default as you run Storybook
});
import MyButton from './MyButton.vue'
import Welcome from './Welcome.vue'
storiesOf('Welcome', module)
.add('to Storybook', () => ({
components: {
Welcome
},
template: '<welcome :showApp="action" />',
methods: {
action: linkTo('Button')
}
}))
storiesOf('Button', module)
.addDecorator(withReadme(ButtonReadme))
.addDecorator(withKnobs)
.add(
'with text',
withNotes({text: 'My notes on some bold text'})(() => {
const buttonName = text('Name', 'Arunoda Susiripala')
return {
components: {
MyButton
},
template: `<my-button @click="action">${buttonName}</my-button>`,
methods: {
action: action('clicked')
}
}
})
)
.add('with some emoji', () => ({
components: {
MyButton
},
template: '<my-button @click="action">😀 😎 👍 💯</my-button>',
methods: {
action: action('clicked')
}
}))