forked from algolia/vue-instantsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIndex.stories.js
76 lines (75 loc) · 2.08 KB
/
Index.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
70
71
72
73
74
75
76
import { storiesOf } from '@storybook/vue';
import algoliasearch from 'algoliasearch';
storiesOf('ais-index', module)
.add('default', () => ({
template: `
<div>
<ais-instant-search :search-client="searchClient" index-name="airbnb">
<ais-configure :restrictSearchableAttributes="['name']"/>
<ais-search-box />
<div>
<ais-hits>
<template slot="item" slot-scope="{ item }">
<h3><ais-highlight :hit="item" attribute="name"/></h3>
</template>
</ais-hits>
</div>
<hr />
<ais-index index-name="instant_search">
<ais-hits>
<template slot="item" slot-scope="{ item }">
<h3><ais-highlight :hit="item" attribute="name"/></h3>
</template>
</ais-hits>
</ais-index>
</ais-instant-search>
</div>
`,
data() {
return {
searchClient: algoliasearch(
'latency',
'6be0576ff61c053d5f9a3225e2a90f76'
),
};
},
}))
.add('shared and individual widgets', () => ({
template: `
<div>
<ais-instant-search :search-client="searchClient" index-name="instant_search">
<ais-search-box />
<ais-refinement-list attribute="brand" />
<hr />
<ais-refinement-list attribute="categories" />
<ais-configure
:restrictSearchableAttributes="['name']"
hitsPerPage="4"
/>
<ais-hits>
<template slot="item" slot-scope="{ item }">
<h3><ais-highlight :hit="item" attribute="name"/></h3>
</template>
</ais-hits>
<hr />
<ais-index index-name="instant_search_rating_asc">
<ais-refinement-list attribute="brand" />
<ais-hits>
<template slot="item" slot-scope="{ item }">
<h3><ais-highlight :hit="item" attribute="name"/></h3>
</template>
</ais-hits>
</ais-index>
<ais-pagination />
</ais-instant-search>
</div>
`,
data() {
return {
searchClient: algoliasearch(
'latency',
'6be0576ff61c053d5f9a3225e2a90f76'
),
};
},
}));