@everymatrix/casino-filter 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -0
- package/dist/casino-filter.js +659 -0
- package/dist/casino-filter.js.map +1 -0
- package/index.html +37 -0
- package/index.js +1 -0
- package/package.json +40 -0
- package/public/favicon.png +0 -0
- package/public/reset.css +48 -0
- package/rollup.config.js +59 -0
- package/src/CasinoFilter.svelte +541 -0
- package/src/i18n.js +27 -0
- package/src/index.ts +4 -0
- package/src/translations.js +122 -0
- package/stories/CasinoFilter.stories.js +13 -0
- package/tsconfig.json +6 -0
|
@@ -0,0 +1,541 @@
|
|
|
1
|
+
<svelte:options tag={null} />
|
|
2
|
+
<script lang="ts">
|
|
3
|
+
import { getDevice } from 'rvhelper';
|
|
4
|
+
import { _, addNewMessages, setupI18n, setLocale } from './i18n';
|
|
5
|
+
import { Translations } from './translations';
|
|
6
|
+
|
|
7
|
+
export let endpoint:string = '';
|
|
8
|
+
export let datasource:string = '';
|
|
9
|
+
export let lang:string = ''; // Language
|
|
10
|
+
export let translationurl:string = '';
|
|
11
|
+
export let clientstyling:string = '';
|
|
12
|
+
export let clientstylingurl:string = '';
|
|
13
|
+
export let categoryid:string = '';
|
|
14
|
+
export let addfilterselector:string = 'false';
|
|
15
|
+
export let addsortingselector:string = 'false';
|
|
16
|
+
export let filterbylogo:string = 'false';
|
|
17
|
+
|
|
18
|
+
let isFilterActive:boolean = false;
|
|
19
|
+
let userAgent:string = window.navigator.userAgent;
|
|
20
|
+
let vendorArray:Array<any> = [];
|
|
21
|
+
let selectedVendorArray:Array<any> = [];
|
|
22
|
+
let provisionalVendorObject:any = {};
|
|
23
|
+
let fullSelection:boolean = false;
|
|
24
|
+
let selectionNumber:number = 0;
|
|
25
|
+
let isLoading:boolean = true;
|
|
26
|
+
let customStylingContainer:HTMLElement;
|
|
27
|
+
let hasErrors:boolean = false;
|
|
28
|
+
|
|
29
|
+
// start translations area
|
|
30
|
+
setupI18n({ withLocale: 'en', translations: {}});
|
|
31
|
+
|
|
32
|
+
const setTranslationUrl = ():void => {
|
|
33
|
+
let url:string = translationurl;
|
|
34
|
+
|
|
35
|
+
fetch(url).then((res:any) => res.json())
|
|
36
|
+
.then((res) => {
|
|
37
|
+
Object.keys(res).forEach((item:any):void => {
|
|
38
|
+
addNewMessages(item, res[item]);
|
|
39
|
+
});
|
|
40
|
+
}).catch((err:any) => {
|
|
41
|
+
console.log(err);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
Object.keys(Translations).forEach((item) => {
|
|
46
|
+
addNewMessages(item, Translations[item]);
|
|
47
|
+
});
|
|
48
|
+
// end translations area
|
|
49
|
+
|
|
50
|
+
// start custom styling area
|
|
51
|
+
const setClientStyling = ():void => {
|
|
52
|
+
let sheet = document.createElement('style');
|
|
53
|
+
sheet.innerHTML = clientstyling;
|
|
54
|
+
customStylingContainer.appendChild(sheet);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const setClientStylingURL = ():void => {
|
|
58
|
+
let cssFile:HTMLElement = document.createElement('style');
|
|
59
|
+
|
|
60
|
+
fetch(new URL(clientstylingurl))
|
|
61
|
+
.then((res:any) => res.text())
|
|
62
|
+
.then((data:any) => {
|
|
63
|
+
cssFile.innerHTML = data
|
|
64
|
+
|
|
65
|
+
setTimeout(() => { customStylingContainer.appendChild(cssFile); }, 1);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
// end custom styling area
|
|
69
|
+
|
|
70
|
+
if (provisionalVendorObject[categoryid]) {
|
|
71
|
+
provisionalVendorObject = {
|
|
72
|
+
[categoryid]: []
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const toggleList = ():void => {
|
|
77
|
+
isFilterActive = !isFilterActive;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const getVendors = (url:any):Promise<any> => {
|
|
81
|
+
isLoading = true;
|
|
82
|
+
|
|
83
|
+
return new Promise((resolve, reject) => {
|
|
84
|
+
fetch(url)
|
|
85
|
+
.then((res:any) => res.json())
|
|
86
|
+
.then((response:any) => {
|
|
87
|
+
response = response.items;
|
|
88
|
+
|
|
89
|
+
resolve(response.items);
|
|
90
|
+
|
|
91
|
+
selectedVendorArray = [];
|
|
92
|
+
let vendors:any= JSON.parse(localStorage.getItem('vendorFiltersByCategory'));
|
|
93
|
+
|
|
94
|
+
response.forEach((ven:any) => {
|
|
95
|
+
if (!vendors) vendors = { currentCategoryId: [] }
|
|
96
|
+
|
|
97
|
+
if (vendors[categoryid]?.indexOf(ven.id) >= 0) {
|
|
98
|
+
ven.isFilterSelected = true;
|
|
99
|
+
selectedVendorArray.push(ven);
|
|
100
|
+
} else {
|
|
101
|
+
ven.isFilterSelected = false;
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
vendorArray = response;
|
|
106
|
+
|
|
107
|
+
// needed to force the update of the filters value
|
|
108
|
+
updateSelectionNumber();
|
|
109
|
+
|
|
110
|
+
}).catch((err:any) => {
|
|
111
|
+
console.error(err);
|
|
112
|
+
hasErrors = true;
|
|
113
|
+
reject(err);
|
|
114
|
+
}).finally(() => {
|
|
115
|
+
isLoading = false;
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const filterByVendors = (selectedVendor):void => {
|
|
121
|
+
let filters = localStorage.getItem("vendorFiltersByCategory");
|
|
122
|
+
|
|
123
|
+
selectedVendor.isFilterSelected = !selectedVendor.isFilterSelected;
|
|
124
|
+
|
|
125
|
+
if (!selectedVendorArray.length || selectedVendorArray.filter(e => e.name === selectedVendor.name).length == 0) {
|
|
126
|
+
selectedVendorArray.push(selectedVendor);
|
|
127
|
+
} else {
|
|
128
|
+
selectedVendorArray = selectedVendorArray.filter(e => e.name !== selectedVendor.name)
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (filters == null) {
|
|
132
|
+
localStorage.setItem("vendorFiltersByCategory", JSON.stringify(provisionalVendorObject = {
|
|
133
|
+
[categoryid]: selectedVendorArray.map(vendor => vendor.id)
|
|
134
|
+
}));
|
|
135
|
+
} else {
|
|
136
|
+
filters = JSON.parse(filters);
|
|
137
|
+
filters[categoryid] = selectedVendorArray.map(vendor => vendor.id);
|
|
138
|
+
localStorage.setItem("vendorFiltersByCategory", JSON.stringify(filters))
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
window.postMessage({ type: "ApplyFilters", origin: 'filters'}, window.location.href);
|
|
142
|
+
updateSelectionNumber();
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const updateSelectionNumber = ():void => {
|
|
146
|
+
// update filters value
|
|
147
|
+
fullSelection = (selectedVendorArray.length === vendorArray.length || selectedVendorArray.length == 0) ? true : false;
|
|
148
|
+
selectionNumber = selectedVendorArray.length;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const initialLoad = ():void => {
|
|
152
|
+
const url:URL = new URL(`${endpoint}/casino/vendors`);
|
|
153
|
+
|
|
154
|
+
url.searchParams.append("fields" , "id,name,logo,subVendors");
|
|
155
|
+
|
|
156
|
+
url.searchParams.append("language" , lang);
|
|
157
|
+
url.searchParams.append("datasource" , datasource);
|
|
158
|
+
url.searchParams.append("platform", getDevice(userAgent));
|
|
159
|
+
if((categoryid.match(/\$/g) || []).length > 1) {
|
|
160
|
+
url.searchParams.append("filter" , `games(subGroups=${categoryid})`);
|
|
161
|
+
url.searchParams.append("subVendors" , `games(subGroups=${categoryid})`);
|
|
162
|
+
} else {
|
|
163
|
+
url.searchParams.append("filter" , `games(groups=${categoryid})`);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
getVendors(url);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const clearFilters = ():void => {
|
|
170
|
+
isLoading = true;
|
|
171
|
+
|
|
172
|
+
selectedVendorArray = [];
|
|
173
|
+
localStorage.setItem("vendorFiltersByCategory", JSON.stringify(provisionalVendorObject = {
|
|
174
|
+
[categoryid]: selectedVendorArray.map(vendor => vendor.id)
|
|
175
|
+
}));
|
|
176
|
+
|
|
177
|
+
vendorArray.forEach((ven:any) => ven.isFilterSelected = false);
|
|
178
|
+
|
|
179
|
+
setTimeout(() => {
|
|
180
|
+
isLoading = false;
|
|
181
|
+
}, 50);
|
|
182
|
+
|
|
183
|
+
window.postMessage({ type: "ApplyFilters"}, window.location.href);
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
fullSelection = true;
|
|
187
|
+
isFilterActive = false;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
$: endpoint && datasource && categoryid && filterbylogo && initialLoad();
|
|
191
|
+
$: clientstyling && customStylingContainer && setClientStyling();
|
|
192
|
+
$: clientstylingurl && customStylingContainer && setClientStylingURL();
|
|
193
|
+
$: translationurl && setTranslationUrl();
|
|
194
|
+
</script>
|
|
195
|
+
|
|
196
|
+
<div bind:this={customStylingContainer}>
|
|
197
|
+
{#if hasErrors}
|
|
198
|
+
<p class="SearchLoading" part="SearchLoading">{$_('casinoPage.500')}</p>
|
|
199
|
+
{:else}
|
|
200
|
+
{#if !isLoading}
|
|
201
|
+
<div class="FilterContainer {(addfilterselector == 'true' && addsortingselector == 'true') ? 'FilerContainerSplit' : ''}">
|
|
202
|
+
<div class="FilterSelector {isFilterActive ? 'FilterSelectorOpen' : ''}" on:click={() => toggleList()}>
|
|
203
|
+
<div class="FilterMainArea">
|
|
204
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
|
205
|
+
<path id="noun_filter_736223" d="M12.2,22.2a1.018,1.018,0,0,1-.391-.091.939.939,0,0,1-.533-.857v-6.2L5.267,8.9A.95.95,0,0,1,5,8.225V7.149A.93.93,0,0,1,5.924,6.2H20.076A.93.93,0,0,1,21,7.149V8.225a.95.95,0,0,1-.267.675l-6.009,6.148V19.81a.981.981,0,0,1-.32.712l-1.6,1.423A.9.9,0,0,1,12.2,22.2ZM6,8.189,12,14.355a.95.95,0,0,1,.267.675v6.039l1.44-1.277v-4.78a.95.95,0,0,1,.267-.675L19.987,8.17V7.2H6Z" transform="translate(-5 -6.2)" fill="#fff"/>
|
|
206
|
+
</svg>
|
|
207
|
+
<div class="FilterTextContainer">
|
|
208
|
+
<span class="FilterName">{$_('Translations.filterby')}</span>
|
|
209
|
+
<div class="FilterValueContainer">
|
|
210
|
+
<span>{$_('Translations.providers')}</span>
|
|
211
|
+
{#if fullSelection}
|
|
212
|
+
<span class="FilterCounter">{$_('Translations.all')}</span>
|
|
213
|
+
{:else}
|
|
214
|
+
<span class="FilterCounter">{selectionNumber}</span>
|
|
215
|
+
{/if}
|
|
216
|
+
</div>
|
|
217
|
+
</div>
|
|
218
|
+
</div>
|
|
219
|
+
<span class="TriangleInactive {isFilterActive ? 'TriangleActive' : ''}">
|
|
220
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="6.835" viewBox="0 0 14 6.835">
|
|
221
|
+
<path id="arrow" d="M281.541,447.921a.488.488,0,0,0,.295-.122l6.5-5.851a.488.488,0,1,0-.65-.726l-6.176,5.556-6.176-5.556h0a.488.488,0,1,0-.65.726l6.5,5.851a.488.488,0,0,0,.355.122Z" transform="translate(-274.511 -441.088)" fill="#d1d1d1"/>
|
|
222
|
+
</svg>
|
|
223
|
+
</span>
|
|
224
|
+
|
|
225
|
+
</div>
|
|
226
|
+
<div class="FilterDropdownContainer { isFilterActive ? 'FilterOpen' : ''}">
|
|
227
|
+
<ul class="FilterDropdown">
|
|
228
|
+
{#each vendorArray as vendor}
|
|
229
|
+
<li class="FilterItem {filterbylogo === 'true' ? 'FilterItemWithLogos' : ''}" value={vendor.name}>
|
|
230
|
+
<label class="FilterLabel">
|
|
231
|
+
<input type="checkbox" name="checkbox" bind:checked={vendor.isFilterSelected} value={vendor.name} on:click={() => filterByVendors(vendor)}>
|
|
232
|
+
<span class="FiltersCheckmark"></span>
|
|
233
|
+
{#if filterbylogo === "false"}
|
|
234
|
+
<span>{vendor.name}</span>
|
|
235
|
+
{:else if filterbylogo === "true"}
|
|
236
|
+
<img src={vendor.logo} alt="vendor logo" /> <!-- @TODO we should have a placeholder here in case the logo image is missing -->
|
|
237
|
+
{/if}
|
|
238
|
+
</label>
|
|
239
|
+
</li>
|
|
240
|
+
{/each}
|
|
241
|
+
</ul>
|
|
242
|
+
<button class="ClearFilters" on:click={() => clearFilters()} disabled={fullSelection && selectedVendorArray.length != vendorArray.length}>{$_('Translations.clear')}</button>
|
|
243
|
+
</div>
|
|
244
|
+
</div>
|
|
245
|
+
{/if}
|
|
246
|
+
{/if}
|
|
247
|
+
</div>
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
<style lang="scss">
|
|
251
|
+
.FilterContainer {
|
|
252
|
+
color: #fff;
|
|
253
|
+
position: relative;
|
|
254
|
+
z-index: 16;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.FilterSelector {
|
|
258
|
+
background-color: #58586B;
|
|
259
|
+
display: flex;
|
|
260
|
+
position: relative;
|
|
261
|
+
padding: 10px 16px;
|
|
262
|
+
border-radius: 5px;
|
|
263
|
+
justify-content: space-between;
|
|
264
|
+
align-items: center;
|
|
265
|
+
max-width: fit-content;
|
|
266
|
+
cursor: pointer;
|
|
267
|
+
&.FilterSelectorOpen {
|
|
268
|
+
border-radius: 5px 5px 0 0;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.FilterMainArea {
|
|
273
|
+
display: flex;
|
|
274
|
+
align-items: center;
|
|
275
|
+
svg {
|
|
276
|
+
margin-right: 16px;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.FilterName {
|
|
281
|
+
font-size: 11px;
|
|
282
|
+
line-height: 12px;
|
|
283
|
+
color: #D1D1D1;
|
|
284
|
+
text-transform: uppercase;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.FilterTextContainer {
|
|
288
|
+
display: flex;
|
|
289
|
+
flex-direction: column;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.FilterValueContainer {
|
|
293
|
+
font-size: 14px;
|
|
294
|
+
line-height: 16px;
|
|
295
|
+
font-weight: 300;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.TriangleInactive {
|
|
299
|
+
display: block;
|
|
300
|
+
color: currentColor;
|
|
301
|
+
margin: 0 0 0 15px;
|
|
302
|
+
transition: all .5s;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.TriangleActive {
|
|
306
|
+
transform: rotate(180deg);
|
|
307
|
+
position: relative;
|
|
308
|
+
top: 2px;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.FilterDropdownContainer {
|
|
312
|
+
padding: 0;
|
|
313
|
+
background: rgb(88,88,107);
|
|
314
|
+
background: linear-gradient(180deg, rgba(88,88,107,0.9) 0%, rgba(7,7,42,0.9) 95%);
|
|
315
|
+
display: flex;
|
|
316
|
+
flex-direction: column;
|
|
317
|
+
align-items: center;
|
|
318
|
+
transition: max-height 0.15s ease-out;
|
|
319
|
+
max-height: 0;
|
|
320
|
+
border-radius: 0 0 5px 5px;
|
|
321
|
+
position: absolute;
|
|
322
|
+
top: 48px;
|
|
323
|
+
margin-bottom: 40px;
|
|
324
|
+
overflow: hidden;
|
|
325
|
+
margin: 0;
|
|
326
|
+
&.FilterOpen {
|
|
327
|
+
width: 100%;
|
|
328
|
+
max-height: fit-content;
|
|
329
|
+
transition: max-height 0.25s ease-in;
|
|
330
|
+
padding-top: 20px;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.FilterDropdown {
|
|
335
|
+
width: 100%;
|
|
336
|
+
max-height: 300px;
|
|
337
|
+
display: grid;
|
|
338
|
+
gap: 10px;
|
|
339
|
+
margin: 0;
|
|
340
|
+
padding-inline-start: 0;
|
|
341
|
+
overflow: scroll;
|
|
342
|
+
list-style: none;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
// custom checkmark
|
|
346
|
+
.FilterItem {
|
|
347
|
+
position: relative;
|
|
348
|
+
label {
|
|
349
|
+
font-size: 14px;
|
|
350
|
+
font-weight: 300;
|
|
351
|
+
cursor: pointer;
|
|
352
|
+
display: flex;
|
|
353
|
+
align-items: center;
|
|
354
|
+
justify-content: flex-start;
|
|
355
|
+
-webkit-user-select: none; /* Safari */
|
|
356
|
+
-ms-user-select: none; /* IE 10 and IE 11 */
|
|
357
|
+
user-select: none; /* Standard syntax */
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
input {
|
|
361
|
+
cursor: pointer;
|
|
362
|
+
margin-right: 10px;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
&:hover input ~ .FiltersCheckmark {
|
|
366
|
+
background-color: transparent;
|
|
367
|
+
border: 1px solid #D0046C;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
input:checked ~ .FiltersCheckmark {
|
|
371
|
+
background-color: #D0046C;
|
|
372
|
+
border: 1px solid #D0046C;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.FiltersCheckmark {
|
|
376
|
+
transition: all 0.05s ease-in;
|
|
377
|
+
margin: 0 15px;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
/* unchecked checkmark */
|
|
381
|
+
.FiltersCheckmark:after {
|
|
382
|
+
content: "";
|
|
383
|
+
position: absolute;
|
|
384
|
+
left: 9px;
|
|
385
|
+
display: none;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/* checkmark after click */
|
|
389
|
+
input:checked ~ .FiltersCheckmark:after {
|
|
390
|
+
display: block;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
/* checkmark */
|
|
394
|
+
.FiltersCheckmark:after {
|
|
395
|
+
left: 8px;
|
|
396
|
+
top: 4px;
|
|
397
|
+
width: 5px;
|
|
398
|
+
height: 10px;
|
|
399
|
+
border: 1px solid white;
|
|
400
|
+
border-width: 0 2px 2px 0;
|
|
401
|
+
-webkit-transform: rotate(45deg);
|
|
402
|
+
-ms-transform: rotate(45deg);
|
|
403
|
+
transform: rotate(45deg);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
.FilerContainerSplit {
|
|
408
|
+
.FilterItemWithLogos {
|
|
409
|
+
.FiltersCheckmark {
|
|
410
|
+
margin: 0;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
.FilterLabel {
|
|
416
|
+
input {
|
|
417
|
+
position: absolute;
|
|
418
|
+
opacity: 0;
|
|
419
|
+
cursor: pointer;
|
|
420
|
+
height: 0;
|
|
421
|
+
width: 0;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
.FiltersCheckmark {
|
|
425
|
+
border-radius: 8px;
|
|
426
|
+
position: relative;
|
|
427
|
+
height: 22px;
|
|
428
|
+
width: 22px;
|
|
429
|
+
min-width: 22px;
|
|
430
|
+
background-color: transparent;
|
|
431
|
+
border: 1px solid #fff;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
.FilterItemWithLogos {
|
|
436
|
+
label {
|
|
437
|
+
height: 70px;
|
|
438
|
+
display: flex;
|
|
439
|
+
justify-content: space-evenly;
|
|
440
|
+
align-items: center;
|
|
441
|
+
img {
|
|
442
|
+
width: 70px;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
.FilterLabel input:checked + span {
|
|
448
|
+
font-weight: 600;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
.FilterCounter {
|
|
452
|
+
display: inline-flex;
|
|
453
|
+
margin-left: 10px;
|
|
454
|
+
min-width: 17px;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
.ClearFilters {
|
|
458
|
+
margin: 20px auto;
|
|
459
|
+
border: 0;
|
|
460
|
+
color: #fff;
|
|
461
|
+
background-color: var(--emfe-w-color-primary, #D0046C);
|
|
462
|
+
border: 1px solid var(--emfe-w-color-primary, #D0046C);
|
|
463
|
+
font-size: 18px;
|
|
464
|
+
padding: 10px 50px;
|
|
465
|
+
border-radius: 5px;
|
|
466
|
+
cursor: pointer;
|
|
467
|
+
transition: all 0.1s ease-in;
|
|
468
|
+
-webkit-user-select: none; /* Safari */
|
|
469
|
+
-ms-user-select: none; /* IE 10 and IE 11 */
|
|
470
|
+
user-select: none; /* Standard syntax */
|
|
471
|
+
&:disabled {
|
|
472
|
+
background: var(--emfe-w-color-gray-100, #E6E6E6);
|
|
473
|
+
border: 1px solid var(--emfe-w-color-gray-150, #828282);
|
|
474
|
+
pointer-events: none;
|
|
475
|
+
cursor: not-allowed;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
@media only screen and (max-width: 768px) {
|
|
480
|
+
.FilterSelector {
|
|
481
|
+
max-width: initial;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
.FilterDropdownContainer {
|
|
485
|
+
width: 100%;
|
|
486
|
+
margin-bottom: 20px;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
.FilterDropdown {
|
|
490
|
+
display: grid;
|
|
491
|
+
grid-template-columns: minmax(150px, 150px) minmax(150px, 150px);
|
|
492
|
+
gap: 30px;
|
|
493
|
+
margin-block-start: 0;;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
.FilterItemWithLogos {
|
|
497
|
+
label {
|
|
498
|
+
justify-content: center;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
.FilerContainerSplit {
|
|
503
|
+
.FilterSelector {
|
|
504
|
+
padding: 7px;
|
|
505
|
+
.FilterCounter {
|
|
506
|
+
margin-left: 0;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
.FilterMainArea svg {
|
|
510
|
+
margin: 0 10px;
|
|
511
|
+
}
|
|
512
|
+
.FilterDropdown {
|
|
513
|
+
grid-template-columns: 1fr;
|
|
514
|
+
}
|
|
515
|
+
.FilterDropdownContainer {
|
|
516
|
+
top: 42px;
|
|
517
|
+
}
|
|
518
|
+
.ClearFilters {
|
|
519
|
+
padding: 10px 25px;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
.FilterLabel .FiltersCheckmark {
|
|
524
|
+
margin-right: 15px;;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
.FilterItem.FilterItemWithLogos {
|
|
528
|
+
display: flex;
|
|
529
|
+
align-items: center;
|
|
530
|
+
justify-content: center;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
.FilerContainerSplit {
|
|
534
|
+
.FilterItemWithLogos {
|
|
535
|
+
.FiltersCheckmark {
|
|
536
|
+
margin: 0 20px 0 0;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
</style>
|
package/src/i18n.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
dictionary,
|
|
3
|
+
locale,
|
|
4
|
+
addMessages,
|
|
5
|
+
_
|
|
6
|
+
} from 'svelte-i18n';
|
|
7
|
+
|
|
8
|
+
function setupI18n({ withLocale: _locale, translations }) {
|
|
9
|
+
locale.subscribe((data) => {
|
|
10
|
+
if (data == null) {
|
|
11
|
+
dictionary.set(translations);
|
|
12
|
+
locale.set(_locale);
|
|
13
|
+
}
|
|
14
|
+
}); // maybe we will need this to make sure that the i18n is set up only once
|
|
15
|
+
/*dictionary.set(translations);
|
|
16
|
+
locale.set(_locale);*/
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function addNewMessages(lang, dict) {
|
|
20
|
+
addMessages(lang, dict);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function setLocale(_locale) {
|
|
24
|
+
locale.set(_locale);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { _, setupI18n, addNewMessages, setLocale };
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
export const Translations = {
|
|
2
|
+
'en': {
|
|
3
|
+
'Translations': {
|
|
4
|
+
'providers': 'Providers:',
|
|
5
|
+
'filterby': 'Filter by:',
|
|
6
|
+
'all': 'all',
|
|
7
|
+
'clear': 'Clear all'
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
'zh': {
|
|
11
|
+
'Translations': {
|
|
12
|
+
'providers': 'Providers:',
|
|
13
|
+
'filterby': 'Filter by',
|
|
14
|
+
'all': 'all',
|
|
15
|
+
'clear': 'Clear all'
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
'de': {
|
|
19
|
+
'Translations': {
|
|
20
|
+
'providers': 'Providers:',
|
|
21
|
+
'filterby': 'Filter by:',
|
|
22
|
+
'all': 'all',
|
|
23
|
+
'clear': 'Clear all'
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
'it': {
|
|
27
|
+
'Translations': {
|
|
28
|
+
'providers': 'Providers:',
|
|
29
|
+
'filterby': 'Filter by:',
|
|
30
|
+
'all': 'all',
|
|
31
|
+
'clear': 'Clear all'
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
'fr': {
|
|
35
|
+
'Translations': {
|
|
36
|
+
'providers': 'Providers:',
|
|
37
|
+
'filterby': 'Filter by:',
|
|
38
|
+
'all': 'all',
|
|
39
|
+
'clear': 'Clear all'
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
'es': {
|
|
43
|
+
'Translations': {
|
|
44
|
+
'providers': 'Providers:',
|
|
45
|
+
'filterby': 'Filter by:',
|
|
46
|
+
'all': 'all',
|
|
47
|
+
'clear': 'Clear all'
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
'tr': {
|
|
51
|
+
'Translations': {
|
|
52
|
+
'providers': 'Providers:',
|
|
53
|
+
'filterby': 'Filter by:',
|
|
54
|
+
'all': 'all',
|
|
55
|
+
'clear': 'Clear all'
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
'ru': {
|
|
59
|
+
'Translations': {
|
|
60
|
+
'providers': 'Providers:',
|
|
61
|
+
'filterby': 'Filter by:',
|
|
62
|
+
'all': 'all',
|
|
63
|
+
'clear': 'Clear all'
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
'ro': {
|
|
67
|
+
'Translations': {
|
|
68
|
+
'providers': 'Providers:',
|
|
69
|
+
'filterby': 'Filter by:',
|
|
70
|
+
'all': 'all',
|
|
71
|
+
'clear': 'Clear all'
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
'hr': {
|
|
75
|
+
'Translations': {
|
|
76
|
+
'providers': 'Providers:',
|
|
77
|
+
'filterby': 'Filter by:',
|
|
78
|
+
'all': 'all',
|
|
79
|
+
'clear': 'Clear all'
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
'hu': {
|
|
83
|
+
'Translations': {
|
|
84
|
+
'providers': 'Providers:',
|
|
85
|
+
'filterby': 'Filter by:',
|
|
86
|
+
'all': 'all',
|
|
87
|
+
'clear': 'Clear all'
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
'pl': {
|
|
91
|
+
'Translations': {
|
|
92
|
+
'providers': 'Providers:',
|
|
93
|
+
'filterby': 'Filter by:',
|
|
94
|
+
'all': 'all',
|
|
95
|
+
'clear': 'Clear all'
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
'pt': {
|
|
99
|
+
'Translations': {
|
|
100
|
+
'providers': 'Providers:',
|
|
101
|
+
'filterby': 'Filter by:',
|
|
102
|
+
'all': 'all',
|
|
103
|
+
'clear': 'Clear all'
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
'sl': {
|
|
107
|
+
'Translations': {
|
|
108
|
+
'providers': 'Providers:',
|
|
109
|
+
'filterby': 'Filter by:',
|
|
110
|
+
'all': 'all',
|
|
111
|
+
'clear': 'Clear all'
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
'sr': {
|
|
115
|
+
'Translations': {
|
|
116
|
+
'providers': 'Providers:',
|
|
117
|
+
'filterby': 'Filter by:',
|
|
118
|
+
'all': 'all',
|
|
119
|
+
'clear': 'Clear all'
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { html } from 'lit-element';
|
|
2
|
+
|
|
3
|
+
import CasinoFilter from '../src/CasinoFilter';
|
|
4
|
+
|
|
5
|
+
// This default export determines where your story goes in the story list
|
|
6
|
+
export default {
|
|
7
|
+
title: 'CasinoFilter',
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
// 👇 We create a “template” of how args map to rendering
|
|
11
|
+
const CasinoFilter = ({ aProperty }) => html`<casino-filter></casino-filter>`;
|
|
12
|
+
|
|
13
|
+
export const FirstStory = CasinoFilter.bind({});
|