@everymatrix/casino-sort 1.10.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-sort.js +586 -0
- package/dist/casino-sort.js.map +1 -0
- package/index.html +37 -0
- package/index.js +1 -0
- package/package.json +39 -0
- package/public/favicon.png +0 -0
- package/public/reset.css +48 -0
- package/rollup.config.js +59 -0
- package/src/CasinoSort.svelte +459 -0
- package/src/i18n.js +27 -0
- package/src/index.ts +4 -0
- package/src/translations.js +77 -0
- package/stories/CasinoSort.stories.js +13 -0
- package/tsconfig.json +6 -0
package/index.html
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset='utf-8'>
|
|
5
|
+
<meta name='viewport' content='width=device-width,initial-scale=1'>
|
|
6
|
+
|
|
7
|
+
<title>
|
|
8
|
+
casino-sort
|
|
9
|
+
</title>
|
|
10
|
+
<link rel="stylesheet" href="public/reset.css">
|
|
11
|
+
<script src='dist/casino-sort.js'></script>
|
|
12
|
+
</head>
|
|
13
|
+
|
|
14
|
+
<body>
|
|
15
|
+
<style>
|
|
16
|
+
html,body { margin: 0; padding: 0; height: 100%; font-family: "Helvetica Neue", "Helvetica", sans-serif; }
|
|
17
|
+
.header { display: flex; justify-content: center; align-items: center; padding: 10px 20px; margin-bottom: 20px; background: #42a3e2; box-shadow: 3px 4px 5px 0px rgba(0,0,0, .2); }
|
|
18
|
+
.header__logo svg { height: 50px; width: 50px; margin-right: 5px; }
|
|
19
|
+
.header__name { color: #fff; }
|
|
20
|
+
.header__name span { margin-right: 10px; font-weight: bold; }
|
|
21
|
+
.webcomponent { padding: 10px 20px; }
|
|
22
|
+
</style>
|
|
23
|
+
<header class="header">
|
|
24
|
+
<div class="header__logo">
|
|
25
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="161" height="132" viewBox="0 0 161 132"><defs><linearGradient x1="0%" y1="50%" y2="50%" id="a"><stop stop-color="#2A3B8F" offset="0%"/><stop stop-color="#29ABE2" offset="100%"/></linearGradient><linearGradient x1="100%" y1="50%" x2="0%" y2="50%" id="c"><stop stop-color="#B4D44E" offset="0%"/><stop stop-color="#E7F716" offset="100%"/></linearGradient></defs><g fill="none" fill-rule="evenodd"><path fill="#166DA5" d="M160.6 65.9l-17.4 29.3-24.4-29.7 24.4-28.9z"/><path fill="#8FDB69" d="M141.3 100.2l-26.5-31.7-15.9 26.6 24.7 36.1z"/><path fill="#166DA5" d="M141 31.4l-26.2 31.8-15.9-26.6L123.6.9z"/><path fill="url(#a)" opacity=".95" d="M61.1 31.4H141L123.4.7H78.7z M114.8 63.3H159l-15.9-26.8H98.8"/><path fill="url(#c)" opacity=".95" d="M141.3 100.3H61l17.6 30.5h45z M114.8 68.4H159l-15.9 26.8H98.8"/><path fill="#010101" d="M78.6 130.8L41 65.8 79.1.8H37.9L.4 65.8l37.5 65z"/></g></svg>
|
|
26
|
+
</div>
|
|
27
|
+
<h1 class="header__name">
|
|
28
|
+
<span>WEBCOMPONENT:</span> casino-sort
|
|
29
|
+
</h1>
|
|
30
|
+
</header>
|
|
31
|
+
|
|
32
|
+
<div class="webcomponent">
|
|
33
|
+
<casino-sort></casino-sort>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
</body>
|
|
37
|
+
</html>
|
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './dist/casino-sort.js';
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@everymatrix/casino-sort",
|
|
3
|
+
"version": "1.10.0",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"svelte": "src/index.ts",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"start": "sirv public",
|
|
8
|
+
"build": "cross-env NODE_ENV=production rollup -c",
|
|
9
|
+
"dev": "cross-env NODE_ENV=\"development\" rollup -c -w",
|
|
10
|
+
"validate": "svelte-check",
|
|
11
|
+
"test": "echo"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@rollup/plugin-babel": "^5.3.0",
|
|
15
|
+
"@rollup/plugin-commonjs": "^16.0.0",
|
|
16
|
+
"@rollup/plugin-node-resolve": "^10.0.0",
|
|
17
|
+
"@rollup/plugin-typescript": "^6.0.0",
|
|
18
|
+
"@tsconfig/svelte": "^1.0.0",
|
|
19
|
+
"rollup": "^2.3.4",
|
|
20
|
+
"rollup-plugin-dev-server": "^0.4.3",
|
|
21
|
+
"rollup-plugin-livereload": "^2.0.0",
|
|
22
|
+
"rollup-plugin-svelte": "^7.0.0",
|
|
23
|
+
"rollup-plugin-terser": "^7.0.0",
|
|
24
|
+
"rollup-plugin-uglify": "^6.0.4",
|
|
25
|
+
"svelte-check": "^1.0.0",
|
|
26
|
+
"svelte-preprocess": "^5.0.0",
|
|
27
|
+
"tslib": "^2.0.0",
|
|
28
|
+
"typescript": "^3.9.3"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"cross-env": "^7.0.3",
|
|
32
|
+
"sirv-cli": "^1.0.0",
|
|
33
|
+
"svelte": "^3.0.0"
|
|
34
|
+
},
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"gitHead": "9ccf680032da454b5c7417f978da996ec52e4554"
|
|
39
|
+
}
|
|
Binary file
|
package/public/reset.css
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/* http://meyerweb.com/eric/tools/css/reset/
|
|
2
|
+
v2.0 | 20110126
|
|
3
|
+
License: none (public domain)
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
html, body, div, span, applet, object, iframe,
|
|
7
|
+
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
|
8
|
+
a, abbr, acronym, address, big, cite, code,
|
|
9
|
+
del, dfn, em, img, ins, kbd, q, s, samp,
|
|
10
|
+
small, strike, strong, sub, sup, tt, var,
|
|
11
|
+
b, u, i, center,
|
|
12
|
+
dl, dt, dd, ol, ul, li,
|
|
13
|
+
fieldset, form, label, legend,
|
|
14
|
+
table, caption, tbody, tfoot, thead, tr, th, td,
|
|
15
|
+
article, aside, canvas, details, embed,
|
|
16
|
+
figure, figcaption, footer, header, hgroup,
|
|
17
|
+
menu, nav, output, ruby, section, summary,
|
|
18
|
+
time, mark, audio, video {
|
|
19
|
+
margin: 0;
|
|
20
|
+
padding: 0;
|
|
21
|
+
border: 0;
|
|
22
|
+
font-size: 100%;
|
|
23
|
+
font: inherit;
|
|
24
|
+
vertical-align: baseline;
|
|
25
|
+
}
|
|
26
|
+
/* HTML5 display-role reset for older browsers */
|
|
27
|
+
article, aside, details, figcaption, figure,
|
|
28
|
+
footer, header, hgroup, menu, nav, section {
|
|
29
|
+
display: block;
|
|
30
|
+
}
|
|
31
|
+
body {
|
|
32
|
+
line-height: 1;
|
|
33
|
+
}
|
|
34
|
+
ol, ul {
|
|
35
|
+
list-style: none;
|
|
36
|
+
}
|
|
37
|
+
blockquote, q {
|
|
38
|
+
quotes: none;
|
|
39
|
+
}
|
|
40
|
+
blockquote:before, blockquote:after,
|
|
41
|
+
q:before, q:after {
|
|
42
|
+
content: '';
|
|
43
|
+
content: none;
|
|
44
|
+
}
|
|
45
|
+
table {
|
|
46
|
+
border-collapse: collapse;
|
|
47
|
+
border-spacing: 0;
|
|
48
|
+
}
|
package/rollup.config.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import svelte from 'rollup-plugin-svelte';
|
|
2
|
+
import commonjs from '@rollup/plugin-commonjs';
|
|
3
|
+
import resolve from '@rollup/plugin-node-resolve';
|
|
4
|
+
import serve from 'rollup-plugin-dev-server';
|
|
5
|
+
import livereload from 'rollup-plugin-livereload';
|
|
6
|
+
import { terser } from 'rollup-plugin-terser';
|
|
7
|
+
import sveltePreprocess from 'svelte-preprocess';
|
|
8
|
+
import typescript from '@rollup/plugin-typescript';
|
|
9
|
+
const production = process.env.NODE_ENV === 'production';
|
|
10
|
+
const dev = process.env.NODE_ENV === 'development';
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
input: 'src/index.ts',
|
|
14
|
+
output: {
|
|
15
|
+
sourcemap: true,
|
|
16
|
+
format: 'umd',
|
|
17
|
+
name: 'app',
|
|
18
|
+
file: 'dist/casino-sort.js'
|
|
19
|
+
},
|
|
20
|
+
plugins: [
|
|
21
|
+
svelte({
|
|
22
|
+
preprocess: sveltePreprocess(),
|
|
23
|
+
compilerOptions: {
|
|
24
|
+
// enable run-time checks when not in production
|
|
25
|
+
customElement: true,
|
|
26
|
+
dev: !production
|
|
27
|
+
}
|
|
28
|
+
}),
|
|
29
|
+
commonjs(),
|
|
30
|
+
resolve({
|
|
31
|
+
browser: true,
|
|
32
|
+
dedupe: ['svelte']
|
|
33
|
+
}),
|
|
34
|
+
dev && serve({
|
|
35
|
+
open: true,
|
|
36
|
+
verbose: true,
|
|
37
|
+
allowCrossOrigin: true,
|
|
38
|
+
historyApiFallback: false,
|
|
39
|
+
host: 'localhost',
|
|
40
|
+
port: 5050,
|
|
41
|
+
}),
|
|
42
|
+
dev && livereload({ watch: ['', 'dist'] }),
|
|
43
|
+
typescript({
|
|
44
|
+
sourceMap: !production,
|
|
45
|
+
inlineSources: !production,
|
|
46
|
+
}),
|
|
47
|
+
// If we're building for production (npm run build
|
|
48
|
+
// instead of npm run dev), minify
|
|
49
|
+
production &&
|
|
50
|
+
terser({
|
|
51
|
+
output: {
|
|
52
|
+
comments: "all"
|
|
53
|
+
},
|
|
54
|
+
})
|
|
55
|
+
],
|
|
56
|
+
watch: {
|
|
57
|
+
clearScreen: false
|
|
58
|
+
}
|
|
59
|
+
};
|
|
@@ -0,0 +1,459 @@
|
|
|
1
|
+
<svelte:options tag={null} />
|
|
2
|
+
<script lang="ts">
|
|
3
|
+
|
|
4
|
+
import { _, addNewMessages, setupI18n, setLocale } from './i18n';
|
|
5
|
+
import { Translations } from './translations';
|
|
6
|
+
|
|
7
|
+
export let lang:string = ''; // Language
|
|
8
|
+
export let translationurl:string = '';
|
|
9
|
+
export let clientstyling:string = '';
|
|
10
|
+
export let clientstylingurl:string = '';
|
|
11
|
+
export let addSorterSelector:string = 'false';
|
|
12
|
+
export let addsortingselector:string = 'false';
|
|
13
|
+
export let categoryid:string = '';
|
|
14
|
+
|
|
15
|
+
let customStylingContainer:HTMLElement;
|
|
16
|
+
let hasErrors:boolean = false;
|
|
17
|
+
let isSorterActive:boolean = false;
|
|
18
|
+
let isLoading:boolean = true;
|
|
19
|
+
let sortedBy:string = '';
|
|
20
|
+
let vendorSortingBy:any = {};
|
|
21
|
+
let sorter:any = {};
|
|
22
|
+
|
|
23
|
+
setupI18n({ withLocale: 'en', translations: {}});
|
|
24
|
+
|
|
25
|
+
const vendorMap = {
|
|
26
|
+
'All': 'All',
|
|
27
|
+
'name': 'A-Z',
|
|
28
|
+
'isNew': 'Newest',
|
|
29
|
+
'advancedTags(name(hot))': 'Hottest',
|
|
30
|
+
}
|
|
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
|
+
|
|
49
|
+
const setClientStyling = ():void => {
|
|
50
|
+
let sheet = document.createElement('style');
|
|
51
|
+
sheet.innerHTML = clientstyling;
|
|
52
|
+
customStylingContainer.appendChild(sheet);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const setClientStylingURL = ():void => {
|
|
56
|
+
let cssFile:HTMLElement = document.createElement('style');
|
|
57
|
+
|
|
58
|
+
fetch(new URL(clientstylingurl))
|
|
59
|
+
.then((res:any) => res.text())
|
|
60
|
+
.then((data:any) => {
|
|
61
|
+
cssFile.innerHTML = data
|
|
62
|
+
|
|
63
|
+
setTimeout(() => { customStylingContainer.appendChild(cssFile); }, 1);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const initialLoad = ():void => {
|
|
68
|
+
isLoading = false;
|
|
69
|
+
isSorterActive = false;
|
|
70
|
+
let parser = JSON.parse(localStorage.getItem('vendorSortingBy'))?.[categoryid];
|
|
71
|
+
if (parser) {
|
|
72
|
+
vendorSortingBy = parser;
|
|
73
|
+
} else {
|
|
74
|
+
vendorSortingBy = 'All'
|
|
75
|
+
}
|
|
76
|
+
vendorSortingBy = vendorMap[parser]
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const sortBy = (input):void => {
|
|
80
|
+
vendorSortingBy = input;
|
|
81
|
+
let sorts = localStorage.getItem("vendorSortingBy");
|
|
82
|
+
sortedBy = input;
|
|
83
|
+
for (let key in vendorMap) {
|
|
84
|
+
if (vendorMap[key] === input) {
|
|
85
|
+
sortedBy = key;
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if(sorts == null) {
|
|
91
|
+
localStorage.setItem("vendorSortingBy", JSON.stringify(sorter = {
|
|
92
|
+
[categoryid]:sortedBy
|
|
93
|
+
}))
|
|
94
|
+
} else {
|
|
95
|
+
sorts = JSON.parse(sorts);
|
|
96
|
+
sorts[categoryid] = sortedBy;
|
|
97
|
+
localStorage.setItem("vendorSortingBy", JSON.stringify(sorts));
|
|
98
|
+
}
|
|
99
|
+
window.postMessage({ type: "ApplySorter", sortBy: sortedBy, itemId: categoryid}, window.location.href);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const toggleList = ():void => {
|
|
103
|
+
isSorterActive = !isSorterActive;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
$: categoryid && initialLoad();
|
|
107
|
+
$: clientstyling && customStylingContainer && setClientStyling();
|
|
108
|
+
$: clientstylingurl && customStylingContainer && setClientStylingURL();
|
|
109
|
+
$: translationurl && setTranslationUrl();
|
|
110
|
+
|
|
111
|
+
</script>
|
|
112
|
+
|
|
113
|
+
<div bind:this={customStylingContainer}>
|
|
114
|
+
{#if hasErrors}
|
|
115
|
+
<p class="SearchLoading" part="SearchLoading">{$_('casinoPage.500')}</p>
|
|
116
|
+
{:else}
|
|
117
|
+
{#if !isLoading}
|
|
118
|
+
<div class="SorterContainer {(addSorterSelector == 'true' && addsortingselector == 'true') ? 'SorterContainerSplitt' : ''}">
|
|
119
|
+
<div class="SorterSelector {isSorterActive ? 'SorterSelectorOpen' : ''}" on:click={() => toggleList()}>
|
|
120
|
+
<div class="SorterMainArea">
|
|
121
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 26.003 22.819">
|
|
122
|
+
<g id="sortby" transform="translate(-306 -342)">
|
|
123
|
+
<path id="Path_5267" data-name="Path 5267" d="M526.245,343.685a3.45,3.45,0,0,1,0,6.714v13.625a.8.8,0,0,1-1.592,0V350.4a3.45,3.45,0,0,1,0-6.714V342.8a.8.8,0,1,1,1.592,0Zm-2.653,3.357a1.857,1.857,0,1,0,1.857-1.857A1.859,1.859,0,0,0,523.592,347.041Z" transform="translate(-206.448 0)" fill="#fff"/>
|
|
124
|
+
<path id="Path_5268" data-name="Path 5268" d="M310.245,356.421a3.45,3.45,0,0,1,0,6.714v.888a.8.8,0,0,1-1.592,0v-.888a3.45,3.45,0,0,1,0-6.714V342.8a.8.8,0,1,1,1.592,0Zm-2.653,3.357a1.857,1.857,0,1,0,1.857-1.857A1.859,1.859,0,0,0,307.592,359.777Z" transform="translate(0 0)" fill="#fff"/>
|
|
125
|
+
<path id="Path_5269" data-name="Path 5269" d="M742.245,351.645a3.45,3.45,0,0,1,0,6.714v5.665a.8.8,0,1,1-1.592,0v-5.665a3.45,3.45,0,0,1,0-6.714V342.8a.8.8,0,1,1,1.592,0ZM739.592,355a1.857,1.857,0,1,0,1.857-1.857A1.859,1.859,0,0,0,739.592,355Z" transform="translate(-412.896 0)" fill="#fff"/>
|
|
126
|
+
</g>
|
|
127
|
+
</svg>
|
|
128
|
+
<div class="SorterTextContainer">
|
|
129
|
+
<span class="SorterName">{$_('Translations.sortby')}</span>
|
|
130
|
+
<div class="SorterValueContainer">
|
|
131
|
+
{#if vendorSortingBy}
|
|
132
|
+
<span>{vendorSortingBy}</span>
|
|
133
|
+
{/if}
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
<span class="TriangleInactive {isSorterActive ? 'TriangleActive' : ''}">
|
|
138
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="6.835" viewBox="0 0 14 6.835">
|
|
139
|
+
<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"/>
|
|
140
|
+
</svg>
|
|
141
|
+
</span>
|
|
142
|
+
</div>
|
|
143
|
+
<div class="SorterDropdownContainer { isSorterActive ? 'SorterOpen' : ''}">
|
|
144
|
+
<ul class="SorterDropdown" style="list-style-type: none; padding: 10px 0px;margin: 0;">
|
|
145
|
+
{#each Object.values(vendorMap) as sort}
|
|
146
|
+
<li class="FilterItem" value=sort>
|
|
147
|
+
<label class="SorterLabel">
|
|
148
|
+
<input type="radio" name="checkbox" value=sort checked={vendorSortingBy == sort ? true : false} on:click={() => sortBy(sort)}>
|
|
149
|
+
<span class="SortersCheckmark"></span>
|
|
150
|
+
<span>{sort}</span>
|
|
151
|
+
</label>
|
|
152
|
+
</li>
|
|
153
|
+
{/each}
|
|
154
|
+
</ul>
|
|
155
|
+
</div>
|
|
156
|
+
</div>
|
|
157
|
+
{/if}
|
|
158
|
+
{/if}
|
|
159
|
+
</div>
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
<style lang="scss">
|
|
164
|
+
.SorterContainer {
|
|
165
|
+
color: #fff;
|
|
166
|
+
position: relative;
|
|
167
|
+
z-index: 16;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.SorterSelector {
|
|
171
|
+
background-color: #58586B;
|
|
172
|
+
display: flex;
|
|
173
|
+
position: relative;
|
|
174
|
+
padding: 10px 16px;
|
|
175
|
+
border-radius: 5px;
|
|
176
|
+
justify-content: space-between;
|
|
177
|
+
align-items: center;
|
|
178
|
+
cursor: pointer;
|
|
179
|
+
&.SorterSelectorOpen {
|
|
180
|
+
border-radius: 5px 5px 0 0;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.SorterMainArea {
|
|
185
|
+
display: flex;
|
|
186
|
+
align-items: center;
|
|
187
|
+
svg {
|
|
188
|
+
margin-right: 16px;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.SorterName {
|
|
193
|
+
font-size: 11px;
|
|
194
|
+
line-height: 12px;
|
|
195
|
+
color: #D1D1D1;
|
|
196
|
+
text-transform: uppercase;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.SorterTextContainer {
|
|
200
|
+
display: flex;
|
|
201
|
+
flex-direction: column;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.SorterValueContainer {
|
|
205
|
+
font-size: 14px;
|
|
206
|
+
line-height: 16px;
|
|
207
|
+
font-weight: 300;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.TriangleInactive {
|
|
211
|
+
display: block;
|
|
212
|
+
color: currentColor;
|
|
213
|
+
margin: 0 0 0 15px;
|
|
214
|
+
transition: all .5s;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.TriangleActive {
|
|
218
|
+
transform: rotate(180deg);
|
|
219
|
+
position: relative;
|
|
220
|
+
top: 2px;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.SorterDropdownContainer {
|
|
224
|
+
padding: 0;
|
|
225
|
+
background: rgb(88,88,107);
|
|
226
|
+
background: linear-gradient(180deg, rgba(88,88,107,0.9) 0%, rgba(7,7,42,0.9) 95%);
|
|
227
|
+
display: flex;
|
|
228
|
+
flex-direction: column;
|
|
229
|
+
align-items: center;
|
|
230
|
+
transition: max-height 0.15s ease-out;
|
|
231
|
+
max-height: 0;
|
|
232
|
+
border-radius: 0 0 5px 5px;
|
|
233
|
+
position: absolute;
|
|
234
|
+
top: 35px;
|
|
235
|
+
margin-bottom: 40px;
|
|
236
|
+
overflow: hidden;
|
|
237
|
+
margin: 0;
|
|
238
|
+
&.SorterOpen {
|
|
239
|
+
width: 100%;
|
|
240
|
+
max-height: fit-content;
|
|
241
|
+
transition: max-height 0.25s ease-in;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.FilterDropdown {
|
|
246
|
+
width: 100%;
|
|
247
|
+
max-height: 300px;
|
|
248
|
+
display: grid;
|
|
249
|
+
gap: 10px;
|
|
250
|
+
margin: 0;
|
|
251
|
+
padding-inline-start: 0;
|
|
252
|
+
overflow: scroll;
|
|
253
|
+
list-style: none;
|
|
254
|
+
-ms-overflow-style: none; /* Internet Explorer 10+ */
|
|
255
|
+
scrollbar-width: none; /* Firefox */
|
|
256
|
+
|
|
257
|
+
&::-webkit-scrollbar {
|
|
258
|
+
display: none; /* Safari and Chrome */
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
// custom checkmark
|
|
264
|
+
.FilterItem {
|
|
265
|
+
position: relative;
|
|
266
|
+
label {
|
|
267
|
+
font-size: 14px;
|
|
268
|
+
font-weight: 300;
|
|
269
|
+
cursor: pointer;
|
|
270
|
+
display: flex;
|
|
271
|
+
align-items: center;
|
|
272
|
+
justify-content: flex-start;
|
|
273
|
+
-webkit-user-select: none; /* Safari */
|
|
274
|
+
-ms-user-select: none; /* IE 10 and IE 11 */
|
|
275
|
+
user-select: none; /* Standard syntax */
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
input {
|
|
279
|
+
cursor: pointer;
|
|
280
|
+
margin-right: 10px;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
&:hover input ~ .SortersCheckmark {
|
|
284
|
+
background-color: transparent;
|
|
285
|
+
border: 1px solid #D0046C;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
input:checked ~ .SortersCheckmark {
|
|
289
|
+
background-color: #D0046C;
|
|
290
|
+
border: 1px solid #D0046C;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.SortersCheckmark {
|
|
294
|
+
transition: all 0.05s ease-in;
|
|
295
|
+
margin: 0 15px;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/* unchecked checkmark */
|
|
299
|
+
.SortersCheckmark:after {
|
|
300
|
+
content: "";
|
|
301
|
+
position: absolute;
|
|
302
|
+
left: 9px;
|
|
303
|
+
display: none;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/* checkmark after click */
|
|
307
|
+
input:checked ~ .SortersCheckmark:after {
|
|
308
|
+
display: block;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/* checkmark */
|
|
312
|
+
.SortersCheckmark:after {
|
|
313
|
+
left: 8px;
|
|
314
|
+
top: 4px;
|
|
315
|
+
width: 5px;
|
|
316
|
+
height: 10px;
|
|
317
|
+
border: 1px solid white;
|
|
318
|
+
border-width: 0 2px 2px 0;
|
|
319
|
+
-webkit-transform: rotate(45deg);
|
|
320
|
+
-ms-transform: rotate(45deg);
|
|
321
|
+
transform: rotate(45deg);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.SorterContainerSplitt {
|
|
326
|
+
.FilterItemWithLogos {
|
|
327
|
+
.SortersCheckmark {
|
|
328
|
+
margin: 0;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.SorterLabel {
|
|
334
|
+
input {
|
|
335
|
+
position: absolute;
|
|
336
|
+
opacity: 0;
|
|
337
|
+
cursor: pointer;
|
|
338
|
+
height: 0;
|
|
339
|
+
width: 0;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.SortersCheckmark {
|
|
343
|
+
border-radius: 8px;
|
|
344
|
+
position: relative;
|
|
345
|
+
height: 22px;
|
|
346
|
+
width: 22px;
|
|
347
|
+
min-width: 22px;
|
|
348
|
+
background-color: transparent;
|
|
349
|
+
border: 1px solid #fff;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
.FilterItemWithLogos {
|
|
354
|
+
label {
|
|
355
|
+
height: 70px;
|
|
356
|
+
display: flex;
|
|
357
|
+
justify-content: space-evenly;
|
|
358
|
+
align-items: center;
|
|
359
|
+
img {
|
|
360
|
+
width: 70px;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
.SorterLabel input:checked + span {
|
|
366
|
+
font-weight: 600;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.FilterCounter {
|
|
370
|
+
display: inline-flex;
|
|
371
|
+
margin-left: 10px;
|
|
372
|
+
min-width: 17px;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.ClearSorters {
|
|
376
|
+
margin: 20px auto;
|
|
377
|
+
border: 0;
|
|
378
|
+
color: #fff;
|
|
379
|
+
background-color: var(--emfe-w-color-primary, #D0046C);
|
|
380
|
+
border: 1px solid var(--emfe-w-color-primary, #D0046C);
|
|
381
|
+
font-size: 18px;
|
|
382
|
+
padding: 10px 50px;
|
|
383
|
+
border-radius: 5px;
|
|
384
|
+
cursor: pointer;
|
|
385
|
+
transition: all 0.1s ease-in;
|
|
386
|
+
-webkit-user-select: none; /* Safari */
|
|
387
|
+
-ms-user-select: none; /* IE 10 and IE 11 */
|
|
388
|
+
user-select: none; /* Standard syntax */
|
|
389
|
+
&:disabled {
|
|
390
|
+
background: var(--emfe-w-color-gray-100, #E6E6E6);
|
|
391
|
+
border: 1px solid var(--emfe-w-color-gray-150, #828282);
|
|
392
|
+
pointer-events: none;
|
|
393
|
+
cursor: not-allowed;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
@media only screen and (max-width: 768px) {
|
|
398
|
+
.SorterSelector {
|
|
399
|
+
max-width: initial;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
.FilterDropdownContainer {
|
|
403
|
+
width: 100%;
|
|
404
|
+
margin-bottom: 20px;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
.FilterDropdown {
|
|
408
|
+
display: grid;
|
|
409
|
+
grid-template-columns: minmax(150px, 150px) minmax(150px, 150px);
|
|
410
|
+
gap: 30px;
|
|
411
|
+
margin-block-start: 0;;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.FilterItemWithLogos {
|
|
415
|
+
label {
|
|
416
|
+
justify-content: center;
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
.SorterContainerSplitt {
|
|
421
|
+
.SorterSelector {
|
|
422
|
+
padding: 7px;
|
|
423
|
+
.FilterCounter {
|
|
424
|
+
margin-left: 0;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
.SorterMainArea svg {
|
|
428
|
+
margin: 0 10px;
|
|
429
|
+
}
|
|
430
|
+
.FilterDropdown {
|
|
431
|
+
grid-template-columns: 1fr;
|
|
432
|
+
}
|
|
433
|
+
.FilterDropdownContainer {
|
|
434
|
+
top: 42px;
|
|
435
|
+
}
|
|
436
|
+
.ClearSorters {
|
|
437
|
+
padding: 10px 25px;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
.SorterLabel .SortersCheckmark {
|
|
442
|
+
margin-right: 15px;;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
.FilterItem.FilterItemWithLogos {
|
|
446
|
+
display: flex;
|
|
447
|
+
align-items: center;
|
|
448
|
+
justify-content: center;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
.SorterContainerSplitt {
|
|
452
|
+
.FilterItemWithLogos {
|
|
453
|
+
.SortersCheckmark {
|
|
454
|
+
margin: 0 20px 0 0;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
</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