-
Notifications
You must be signed in to change notification settings - Fork 51
/
settings.js
201 lines (187 loc) · 5.75 KB
/
settings.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
/*
| -----------------------------------------------------------------------------
| Unified InstantSearch E-commerce by Algolia http://alg.li/unified
| -----------------------------------------------------------------------------
|
| Welcome to the Unified InstantSearch E-commerce configuration file.
| This is where you can customize Unified InstantSearch E-commerce specifically
| for your project.
|
| Unless mandatory, if you don't use a setting, feel free to comment it out.
|
| View the full documentation at http://alg.li/unified/doc
|
*/
import React from 'preact/compat';
import { Hit } from './Hit';
/*
|-------------------------------------------------------------------------------
| Base configuration http://alg.li/unified/base-config
|-------------------------------------------------------------------------------
|
| Here is where you define your base configuration.
|
| This is the starting point of your project. These options are necessary to
| integrate Unified InstantSearch E-commerce in your website, and wire it with
| your Algolia index.
|
*/
export const inputContainer = '#search-button';
export const inputContent = 'Search for products';
export const keyboardShortcuts = ['/'];
export const appId = 'latency';
export const searchApiKey = '6be0576ff61c053d5f9a3225e2a90f76';
export const hitComponent = Hit;
export const index = {
indexName: 'instant_search',
searchParameters: {
analytics: true,
clickAnalytics: true,
hitsPerPage: 18,
attributesToSnippet: ['description:25'],
},
};
/*
|-------------------------------------------------------------------------------
| Insights, Analytics and Personalization http://alg.li/unified/insights
|-------------------------------------------------------------------------------
|
| Here is where you define your Analytics and Personalization settings.
|
| We provide you with ways to measure how your search is doing, and make search
| results more relevant for individual users by personalizing their experience
| based on a unique profile built over time.
|
*/
export const googleAnalytics = false;
export const setUserToken = (setToken) => {
setToken(/* The current user's `userToken` */);
};
/*
|-------------------------------------------------------------------------------
| Sort-by http://alg.li/unified/sort-by
|-------------------------------------------------------------------------------
|
| Here is where you define your different sort-by options.
|
| Algolia sorts search results by relevance, using its ranking formula.
| Yet, you can provide several sorting options based on a specific attribute
| (e.g., descending price) using replica indices.
|
*/
export const sorts = [
{
label: 'Price ascending',
value: 'instant_search_price_asc',
},
{
label: 'Price descending',
value: 'instant_search_price_desc',
},
];
/*
|-------------------------------------------------------------------------------
| Refinements http://alg.li/unified/refinements
|-------------------------------------------------------------------------------
|
| Here is where you define your different refinement options.
|
| We provide you with different types of refinement options to let users narrow
| down their searches based on a specific attribute.
|
| Some refinement types require you to follow a specific record schema.
|
*/
export const refinements = [
{
type: 'hierarchical',
header: 'Categories',
label: 'Category',
options: {
attributes: [
'hierarchicalCategories.lvl0',
'hierarchicalCategories.lvl1',
],
limit: 6,
showMore: true,
},
},
{
type: 'list',
header: 'Brands',
label: 'Brand',
options: {
attribute: 'brand',
searchable: true,
showMore: true,
limit: 6,
showMoreLimit: 20,
translations: {
showMore: (expanded) =>
expanded ? '- View fewer brands' : '+ View more brands',
},
},
},
{
type: 'slider',
header: 'Price',
label: 'Price',
options: {
attribute: 'price',
transformValue: (value) => (
<>
<span className="uni-Hit-currency">$</span>
{value}
</>
),
},
},
];
/*
|-------------------------------------------------------------------------------
| Query Suggestions http://alg.li/unified/query-suggestions
|-------------------------------------------------------------------------------
|
| Here is where you define your Query Suggestions settings.
|
| Query Suggestions let you display a list of relevant queries that your users
| can select from as they type.
|
| This requires a Query Suggestion index that we populate over time with data
| from what your users are searching for. If your index isn't ready yet, feel
| free to comment out this section and re-enable it later.
|
*/
export const suggestionsIndex = {
indexName: 'instant_search_demo_query_suggestions',
searchParameters: {
hitsPerPage: 6,
},
};
/*
|-------------------------------------------------------------------------------
| Styles http://alg.li/unified/styles
|-------------------------------------------------------------------------------
|
| Here is where you define the styling for your search experience.
|
| If you edit these values while in development mode, you must restart the
| server to see your changes.
|
*/
export const styles = {
colors: {
primary: '#d02139',
secondary: '#21243d',
},
text: {
fontFamily: `-apple-system, blinkmacsystemfont, 'Segoe UI', roboto, oxygen,
ubuntu, cantarell, 'Open Sans', 'Helvetica Neue', sans-serif`,
},
breakpoints: {
sm: 640,
md: 768,
lg: 1024,
},
baseZIndex: 100,
};