forked from algolia/vue-instantsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathToggleRefinement.stories.js
69 lines (68 loc) · 1.67 KB
/
ToggleRefinement.stories.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
import { storiesOf } from '@storybook/vue';
import { previewWrapper } from './utils';
storiesOf('ais-toggle-refinement', module)
.addDecorator(previewWrapper())
.add('default', () => ({
template: `
<ais-toggle-refinement
attribute="free_shipping"
label="Free Shipping"
/>
`,
}))
.add('with an on value', () => ({
template: `
<ais-toggle-refinement
attribute="free_shipping"
label="Free Shipping"
:on="true"
/>
`,
}))
.add('with an on value (with multiple values)', () => ({
template: `
<ais-toggle-refinement
attribute="brand"
label="Metra or Samsung"
:on="['Samsung', 'Metra']"
/>
`,
}))
.add('with an off value', () => ({
template: `
<ais-toggle-refinement
attribute="free_shipping"
label="Free Shipping"
:off="false"
/>
`,
}))
.add('with a custom render', () => ({
template: `
<ais-toggle-refinement
attribute="free_shipping"
label="Free Shipping"
>
<a
slot-scope="{ value, refine, createURL }"
:href="createURL()"
@click.prevent="refine(value)"
>
<span>{{ value.name }}</span>
<span>{{ value.isRefined ? '(is enabled)' : '(is disabled)' }}</span>
</a>
</ais-toggle-refinement>
`,
}))
.add('with a Panel', () => ({
template: `
<ais-panel>
<template slot="header">Toggle Refinement</template>
<ais-toggle-refinement
attribute="free_shipping"
label="Free Shipping"
/>
<template slot="footer">Footer</template>
</ais-panel>
`,
}));