@ppg_pl/pallete 0.0.4 → 0.0.6
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/dist/cjs/index-160fcb6c.js +1661 -0
- package/dist/cjs/index-160fcb6c.js.map +1 -0
- package/dist/cjs/index.cjs.js +4 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/loader.cjs.js +24 -0
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/cjs/my-backdrop_8.cjs.entry.js +7985 -0
- package/dist/cjs/my-backdrop_8.cjs.entry.js.map +1 -0
- package/dist/cjs/pallete.cjs.js +28 -0
- package/dist/cjs/pallete.cjs.js.map +1 -0
- package/dist/collection/collection-manifest.json +19 -0
- package/dist/collection/components/api/index.js +20 -0
- package/dist/collection/components/api/index.js.map +1 -0
- package/dist/collection/components/api/services.js +82 -0
- package/dist/collection/components/api/services.js.map +1 -0
- package/dist/collection/components/my-backdrop/my-backdrop.css +13 -0
- package/dist/collection/components/my-backdrop/my-backdrop.js +17 -0
- package/dist/collection/components/my-backdrop/my-backdrop.js.map +1 -0
- package/dist/collection/components/my-colorbox/my-colorbox.css +52 -0
- package/dist/collection/components/my-colorbox/my-colorbox.js +157 -0
- package/dist/collection/components/my-colorbox/my-colorbox.js.map +1 -0
- package/dist/collection/components/my-colorinfo/my-colorinfo.js +187 -0
- package/dist/collection/components/my-colorinfo/my-colorinfo.js.map +1 -0
- package/dist/collection/components/my-component/my-component.css +6 -0
- package/dist/collection/components/my-component/my-component.js +133 -0
- package/dist/collection/components/my-component/my-component.js.map +1 -0
- package/dist/collection/components/my-loader/my-loader.css +85 -0
- package/dist/collection/components/my-loader/my-loader.js +19 -0
- package/dist/collection/components/my-loader/my-loader.js.map +1 -0
- package/dist/collection/components/my-modal/__mocks__/index.js +759 -0
- package/dist/collection/components/my-modal/__mocks__/index.js.map +1 -0
- package/dist/collection/components/my-modal/assets/arrow_down.png +0 -0
- package/dist/collection/components/my-modal/assets/close.png +0 -0
- package/dist/collection/components/my-modal/my-modal.css +367 -0
- package/dist/collection/components/my-modal/my-modal.js +448 -0
- package/dist/collection/components/my-modal/my-modal.js.map +1 -0
- package/dist/collection/components/my-search/assets/search.svg +15 -0
- package/dist/collection/components/my-search/my-search.css +35 -0
- package/dist/collection/components/my-search/my-search.js +125 -0
- package/dist/collection/components/my-search/my-search.js.map +1 -0
- package/dist/collection/components/my-slider/index.js +148 -0
- package/dist/collection/components/my-slider/index.js.map +1 -0
- package/dist/collection/components/my-slider/my-slider.css +88 -0
- package/dist/collection/gtmUtils.js +4 -0
- package/dist/collection/gtmUtils.js.map +1 -0
- package/dist/collection/index.js +2 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/types.js +2 -0
- package/dist/collection/types.js.map +1 -0
- package/{www/build/gtmUtils-dcdac4ce.js → dist/components/gtmUtils.js} +2 -0
- package/dist/components/gtmUtils.js.map +1 -0
- package/dist/components/index.d.ts +9 -11
- package/dist/components/index.js +3 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/index2.js +5305 -0
- package/dist/components/index2.js.map +1 -0
- package/dist/components/my-backdrop.js +8 -0
- package/dist/components/my-backdrop.js.map +1 -0
- package/dist/components/my-backdrop2.js +31 -0
- package/dist/components/my-backdrop2.js.map +1 -0
- package/dist/components/my-colorbox.js +8 -0
- package/dist/components/my-colorbox.js.map +1 -0
- package/dist/{pallete/my-colorbox.entry.js → components/my-colorbox2.js} +37 -8
- package/dist/components/my-colorbox2.js.map +1 -0
- package/dist/components/my-colorinfo.js +8 -0
- package/dist/components/my-colorinfo.js.map +1 -0
- package/dist/{pallete/my-colorinfo.entry.js → components/my-colorinfo2.js} +44 -10
- package/dist/components/my-colorinfo2.js.map +1 -0
- package/dist/{pallete/my-component.entry.js → components/my-component.js} +87 -11
- package/dist/components/my-component.js.map +1 -0
- package/dist/components/my-loader.js +8 -0
- package/dist/components/my-loader.js.map +1 -0
- package/{www/build/my-loader.entry.js → dist/components/my-loader2.js} +23 -7
- package/dist/components/my-loader2.js.map +1 -0
- package/dist/components/my-modal.js +8 -0
- package/dist/components/my-modal.js.map +1 -0
- package/dist/{pallete/my-modal.entry.js → components/my-modal2.js} +120 -120
- package/dist/components/my-modal2.js.map +1 -0
- package/dist/components/my-search.js +8 -0
- package/dist/components/my-search.js.map +1 -0
- package/{www/build/my-search.entry.js → dist/components/my-search2.js} +32 -9
- package/dist/components/my-search2.js.map +1 -0
- package/dist/components/my-slider.js +8 -0
- package/dist/components/my-slider.js.map +1 -0
- package/dist/esm/index-943c259f.js +1632 -0
- package/dist/esm/index-943c259f.js.map +1 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/loader.js +20 -0
- package/dist/esm/loader.js.map +1 -0
- package/dist/esm/my-backdrop_8.entry.js +7974 -0
- package/dist/esm/my-backdrop_8.entry.js.map +1 -0
- package/dist/esm/pallete.js +23 -0
- package/dist/esm/pallete.js.map +1 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/pallete/index.esm.js +1 -0
- package/dist/pallete/index.esm.js.map +1 -0
- package/dist/pallete/p-9a7eff4f.entry.js +2 -0
- package/dist/pallete/p-9a7eff4f.entry.js.map +1 -0
- package/dist/pallete/p-c77aaa54.js +3 -0
- package/dist/pallete/p-c77aaa54.js.map +1 -0
- package/dist/pallete/pallete.css +1 -3
- package/dist/pallete/pallete.esm.js +2 -129
- package/dist/pallete/pallete.esm.js.map +1 -0
- package/dist/types/components/api/services.d.ts +1 -1
- package/dist/types/components/my-component/my-component.d.ts +2 -0
- package/dist/types/components/my-modal/__mocks__/index.d.ts +415 -0
- package/dist/types/components/my-modal/my-modal.d.ts +3 -1
- package/dist/types/components.d.ts +2 -0
- package/dist/types/stencil-public-runtime.d.ts +91 -19
- package/dist/types/types.d.ts +8 -8
- package/loader/index.d.ts +9 -0
- package/loader/package.json +1 -0
- package/package.json +21 -5
- package/www/build/index.esm.js +1 -0
- package/www/build/index.esm.js.map +1 -0
- package/www/build/p-825a7d1d.js +163 -0
- package/www/build/p-9a7eff4f.entry.js +2 -0
- package/www/build/p-9a7eff4f.entry.js.map +1 -0
- package/www/build/p-c77aaa54.js +3 -0
- package/www/build/p-c77aaa54.js.map +1 -0
- package/www/build/p-fd390eef.css +3 -0
- package/www/build/pallete.css +1 -3
- package/www/build/pallete.esm.js +2 -129
- package/www/build/pallete.esm.js.map +1 -0
- package/www/index.html +2 -40
- package/dist/pallete/app-globals-0f993ce5.js +0 -3
- package/dist/pallete/css-shim-60f618b9.js +0 -4
- package/dist/pallete/dom-4eeb3fee.js +0 -73
- package/dist/pallete/gtmUtils-dcdac4ce.js +0 -5
- package/dist/pallete/index-1ac7471e.js +0 -3059
- package/dist/pallete/my-backdrop.entry.js +0 -15
- package/dist/pallete/my-loader.entry.js +0 -15
- package/dist/pallete/my-search.entry.js +0 -36
- package/dist/pallete/my-slider.entry.js +0 -11333
- package/dist/pallete/shadow-css-02866686.js +0 -387
- package/www/build/app-globals-0f993ce5.js +0 -3
- package/www/build/css-shim-60f618b9.js +0 -4
- package/www/build/dom-4eeb3fee.js +0 -73
- package/www/build/index-1ac7471e.js +0 -3059
- package/www/build/my-backdrop.entry.js +0 -15
- package/www/build/my-colorbox.entry.js +0 -40
- package/www/build/my-colorinfo.entry.js +0 -36
- package/www/build/my-component.entry.js +0 -154
- package/www/build/my-modal.entry.js +0 -2459
- package/www/build/my-slider.entry.js +0 -11333
- package/www/build/shadow-css-02866686.js +0 -387
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
import { h, getAssetPath } from '@stencil/core';
|
|
2
|
+
import { ApiService } from '../api';
|
|
3
|
+
import { setDataLayer } from '../../gtmUtils';
|
|
4
|
+
import { fetchCategoryColorsQuery, fetchColorByNumber, fetchProductColorsQuery } from '../api/services';
|
|
5
|
+
export class MyModal {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.boxDesktopWidth = 130;
|
|
8
|
+
this.boxMobileWidth = 85;
|
|
9
|
+
this.desktopPadding = 75;
|
|
10
|
+
this.mobilePadding = 35;
|
|
11
|
+
this.mediumBreakpoint = 1024;
|
|
12
|
+
this.clearInterval = () => {
|
|
13
|
+
this.colorTimerInterval && clearInterval(this.colorTimerInterval);
|
|
14
|
+
this.colorTimerInterval = undefined;
|
|
15
|
+
};
|
|
16
|
+
this.colorTimer = () => {
|
|
17
|
+
if (this.currentColor && this.currentColor.id) {
|
|
18
|
+
this.colorTimerInterval = setInterval(() => {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
((_a = this.currentColor) === null || _a === void 0 ? void 0 : _a.name) &&
|
|
21
|
+
setDataLayer({
|
|
22
|
+
event: 'ColorTimer',
|
|
23
|
+
shop: this.shop,
|
|
24
|
+
product: this.product,
|
|
25
|
+
color: (_b = this.currentColor) === null || _b === void 0 ? void 0 : _b.name,
|
|
26
|
+
timer: '10',
|
|
27
|
+
});
|
|
28
|
+
}, 10000);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
this.clearInterval();
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
this.chunks = (xs, y = []) => {
|
|
35
|
+
return xs.length === 0 ? y : this.chunks(xs.slice(this.chunksNum), y.concat([xs.slice(0, this.chunksNum)]));
|
|
36
|
+
};
|
|
37
|
+
this.calculateBoxCount = () => {
|
|
38
|
+
var _a;
|
|
39
|
+
const modalWidth = this.modalEl.children && this.modalEl.children[0] && ((_a = this.modalEl.children[0]) === null || _a === void 0 ? void 0 : _a.clientWidth) - this.padding;
|
|
40
|
+
const boxWidth = this.boxWidth;
|
|
41
|
+
const calc = Math.floor(modalWidth / boxWidth);
|
|
42
|
+
const boxesCount = calc;
|
|
43
|
+
if (!this.preloader)
|
|
44
|
+
this.chunksNum = boxesCount;
|
|
45
|
+
};
|
|
46
|
+
this.displayForMobile = () => {
|
|
47
|
+
if (window.innerWidth < this.mediumBreakpoint) {
|
|
48
|
+
this.boxWidth = this.boxMobileWidth;
|
|
49
|
+
this.padding = this.mobilePadding;
|
|
50
|
+
this.isMobile = true;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
this.isMobile = false;
|
|
54
|
+
this.boxWidth = this.boxDesktopWidth;
|
|
55
|
+
this.padding = this.desktopPadding;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
this.fetchProductData = async () => {
|
|
59
|
+
try {
|
|
60
|
+
const response = await ApiService.getData(`products?populate[0]=modalLogo&populate[1]=images&populate[2]=shops&populate[3]=categories&filters[name][$contains]=${this.product}`);
|
|
61
|
+
if (response) {
|
|
62
|
+
if (response.data[0].attributes.shops.data.find((shop) => shop.attributes.name === this.shop).id) {
|
|
63
|
+
this.data = Object.assign(Object.assign({}, response.data[0].attributes), { id: response.data[0].id });
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
console.error(error);
|
|
69
|
+
}
|
|
70
|
+
finally {
|
|
71
|
+
this.preloader = false;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
// TODO:
|
|
75
|
+
this.fetchProductColors = async (id, page) => {
|
|
76
|
+
this.loading = true;
|
|
77
|
+
try {
|
|
78
|
+
const response = await ApiService.getData(`colors?${fetchProductColorsQuery(id, page)}`);
|
|
79
|
+
if (response) {
|
|
80
|
+
this.colors = {
|
|
81
|
+
list: response &&
|
|
82
|
+
response.data &&
|
|
83
|
+
response.data.map((item) => (Object.assign({ id: item.id }, item.attributes))),
|
|
84
|
+
pagination: response.meta.pagination,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
console.error(error);
|
|
90
|
+
}
|
|
91
|
+
finally {
|
|
92
|
+
this.loading = false;
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
this.fetchCategoryColors = async (color) => {
|
|
96
|
+
this.loading = true;
|
|
97
|
+
try {
|
|
98
|
+
const response = await ApiService.getData(`colors?${fetchCategoryColorsQuery(color)}`);
|
|
99
|
+
if (response) {
|
|
100
|
+
this.colors = {
|
|
101
|
+
list: response &&
|
|
102
|
+
response.data &&
|
|
103
|
+
response.data.map((item) => (Object.assign({ id: item.id }, item.attributes))),
|
|
104
|
+
pagination: response.meta.pagination,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
console.error(error);
|
|
110
|
+
}
|
|
111
|
+
finally {
|
|
112
|
+
this.loading = false;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
// private onIntersection = async (entries: any) => {
|
|
116
|
+
// console.log(entries[0]);
|
|
117
|
+
// if (entries[0].intersectionRatio === 0) {
|
|
118
|
+
// console.log('d');
|
|
119
|
+
// }
|
|
120
|
+
// };
|
|
121
|
+
// private handleObserve = () => {
|
|
122
|
+
// console.log(this.modalEl.shadowRoot);
|
|
123
|
+
// const boxesList: any = (this.modalEl as any).querySelector('.my-modal__wrapper');
|
|
124
|
+
// console.log(boxesList);
|
|
125
|
+
// if (boxesList) {
|
|
126
|
+
// this.observer = new IntersectionObserver(this.onIntersection);
|
|
127
|
+
// this.observer.observe(boxesList);
|
|
128
|
+
// }
|
|
129
|
+
// };
|
|
130
|
+
this.onPage = (page) => {
|
|
131
|
+
this.data && this.fetchProductColors(String(this.data.id), page);
|
|
132
|
+
this.page = page;
|
|
133
|
+
this.currentColor = null;
|
|
134
|
+
this.currentIndex = null;
|
|
135
|
+
};
|
|
136
|
+
this.handleCategoryClick = (color) => {
|
|
137
|
+
if (this.selectedCategory && color && this.selectedCategory.id === color.id && !this.showRange) {
|
|
138
|
+
this.data && this.fetchProductColors(String(this.data.id));
|
|
139
|
+
this.selectedCategory = null;
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
color && this.fetchCategoryColors(color);
|
|
143
|
+
this.selectedCategory = color;
|
|
144
|
+
}
|
|
145
|
+
this.currentColor = null;
|
|
146
|
+
};
|
|
147
|
+
this.shop = undefined;
|
|
148
|
+
this.product = undefined;
|
|
149
|
+
this.closeImage = 'close.png';
|
|
150
|
+
this.arrowDown = 'arrow_down.png';
|
|
151
|
+
this.chunksNum = 12;
|
|
152
|
+
this.data = null;
|
|
153
|
+
this.preloader = false;
|
|
154
|
+
this.loading = false;
|
|
155
|
+
this.colors = null;
|
|
156
|
+
this.currentColor = null;
|
|
157
|
+
this.currentIndex = null;
|
|
158
|
+
this.infoBoxWidth = null;
|
|
159
|
+
this.boxWidth = this.boxDesktopWidth;
|
|
160
|
+
this.padding = this.desktopPadding;
|
|
161
|
+
this.isMobile = false;
|
|
162
|
+
this.showRange = false;
|
|
163
|
+
this.colorCategories = null;
|
|
164
|
+
this.selectedCategory = null;
|
|
165
|
+
this.page = 1;
|
|
166
|
+
}
|
|
167
|
+
setInfoBoxWidth(newValue) {
|
|
168
|
+
this.infoBoxWidth = newValue * this.boxWidth;
|
|
169
|
+
}
|
|
170
|
+
watchPropHandler(newValue) {
|
|
171
|
+
if (newValue.categories.data.length > 0) {
|
|
172
|
+
this.showRange = true;
|
|
173
|
+
this.handleCategoryClick(newValue.categories.data[0]);
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
this.fetchProductColors(String(newValue.id));
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
async open() {
|
|
180
|
+
this.modalEl.style.display = 'block';
|
|
181
|
+
}
|
|
182
|
+
closeModalHandler() {
|
|
183
|
+
this.close.emit();
|
|
184
|
+
}
|
|
185
|
+
handleReadyToClose(value) {
|
|
186
|
+
this.readyToCLose.emit({ observable: value });
|
|
187
|
+
}
|
|
188
|
+
closeInfoBoxHandler() {
|
|
189
|
+
this.currentColor = null;
|
|
190
|
+
this.currentIndex = null;
|
|
191
|
+
}
|
|
192
|
+
handleResize() {
|
|
193
|
+
this.calculateBoxCount();
|
|
194
|
+
this.displayForMobile();
|
|
195
|
+
}
|
|
196
|
+
async searchColorsHandler(event) {
|
|
197
|
+
var _a;
|
|
198
|
+
// if search is empty set to first category to not showing whole product colors
|
|
199
|
+
if (event.detail === '') {
|
|
200
|
+
this.handleCategoryClick((_a = this.data) === null || _a === void 0 ? void 0 : _a.categories.data[0]);
|
|
201
|
+
}
|
|
202
|
+
try {
|
|
203
|
+
if (this.data && this.data.id && event.detail !== '') {
|
|
204
|
+
this.selectedCategory = null;
|
|
205
|
+
const response = await ApiService.getData(`colors?${fetchColorByNumber(Number(this.data.id), event.detail)}`);
|
|
206
|
+
if (response) {
|
|
207
|
+
this.colors = {
|
|
208
|
+
list: response &&
|
|
209
|
+
response.data &&
|
|
210
|
+
response.data.map((item) => (Object.assign({ id: item.id }, item.attributes))),
|
|
211
|
+
pagination: response.meta.pagination,
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
console.error(error);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
componentWillLoad() {
|
|
221
|
+
this.preloader = true;
|
|
222
|
+
this.fetchProductData();
|
|
223
|
+
}
|
|
224
|
+
componentWillRender() {
|
|
225
|
+
this.displayForMobile();
|
|
226
|
+
this.calculateBoxCount();
|
|
227
|
+
this.colorTimer();
|
|
228
|
+
}
|
|
229
|
+
render() {
|
|
230
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
231
|
+
return (h("div", { class: `my-modal`, onMouseEnter: () => this.handleReadyToClose(false), onMouseLeave: () => this.handleReadyToClose(true) }, this.preloader && (h("div", { class: 'loader' }, h("my-loader", null))), !this.preloader && (h("button", { class: "my-modal__close", onClick: () => this.closeModalHandler() }, h("img", { src: getAssetPath(`./assets/${this.closeImage}`), alt: "closebtn" }))), !this.preloader && this.data && this.data.modalLogo && h("img", { src: `${(_d = (_c = (_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a.modalLogo) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.attributes) === null || _d === void 0 ? void 0 : _d.url}`, alt: "modal-logo" }), !this.preloader && (h("p", { class: "my-modal__see-more" }, (_e = this.data) === null || _e === void 0 ? void 0 : _e.modalDescription)), this.showRange && (h("div", { class: 'categories' }, this.data && h("my-search", { productId: Number((_f = this.data) === null || _f === void 0 ? void 0 : _f.id), isMobile: this.isMobile }), h("div", { class: 'categories__container', style: { maxWidth: `${this.infoBoxWidth}px` } }, (_g = this.data) === null || _g === void 0 ? void 0 : _g.categories.data.map((c) => {
|
|
232
|
+
var _a;
|
|
233
|
+
return (h("my-colorbox", { key: c.id, onClick: () => this.handleCategoryClick(c), color: c.attributes.hex, name: c.attributes.name, shop: this.shop, product: this.product, isCategoryActive: ((_a = this.selectedCategory) === null || _a === void 0 ? void 0 : _a.id) === c.id }));
|
|
234
|
+
})), this.isMobile && (h("div", { class: 'categories__slide-information', style: { width: `${this.infoBoxWidth}px` } }, h("span", null, "Przewi\u0144 w lewo"), h("span", null, "Przewi\u0144 w prawo"))))), h("div", { class: 'my-modal__wrapper' }, this.loading && h("my-loader", null), !this.loading && this.colors && (h("div", { class: 'container_boxes' }, this.colors.list.length > 0 ? (this.chunks(this.colors.list).map((color, index) => {
|
|
235
|
+
var _a;
|
|
236
|
+
return (h("div", { key: index, class: "boxes" }, h("div", { class: "boxes__list" }, color.map((c) => {
|
|
237
|
+
var _a;
|
|
238
|
+
return (h("my-colorbox", { key: c.id, onClick: () => {
|
|
239
|
+
var _a, _b, _c;
|
|
240
|
+
return [
|
|
241
|
+
((_a = this.currentColor) === null || _a === void 0 ? void 0 : _a.id) ? (((_b = this.currentColor) === null || _b === void 0 ? void 0 : _b.id) === c.id ? (this.currentColor = null) : (this.currentColor = c)) : (this.currentColor = c),
|
|
242
|
+
(this.currentIndex = index),
|
|
243
|
+
setDataLayer({
|
|
244
|
+
event: 'ColorClick',
|
|
245
|
+
shop: this.shop,
|
|
246
|
+
product: this.product,
|
|
247
|
+
color: c.name,
|
|
248
|
+
}),
|
|
249
|
+
((_c = this.currentColor) === null || _c === void 0 ? void 0 : _c.id) && this.clearInterval(),
|
|
250
|
+
];
|
|
251
|
+
}, color: c.hex, name: c.name, isActive: ((_a = this.currentColor) === null || _a === void 0 ? void 0 : _a.id) === c.id, shop: this.shop, product: this.product }));
|
|
252
|
+
})), ((_a = this.currentColor) === null || _a === void 0 ? void 0 : _a.id) && index === this.currentIndex && (h("my-colorinfo", { currentColor: this.currentColor, shop: this.shop, product: this.product, data: this.data, isMobile: this.isMobile, infoBoxWidth: this.infoBoxWidth }))));
|
|
253
|
+
})) : (h("p", null, "Brak wynik\u00F3w")), this.colors.pagination.pageCount > 1 && (h("div", { class: 'pagination' }, Array.from({ length: this.colors.pagination.pageCount }).map((page, i) => (h("span", { class: i + 1 === this.page ? 'current' : '', onClick: e => {
|
|
254
|
+
e.preventDefault();
|
|
255
|
+
this.onPage(i + 1);
|
|
256
|
+
}, key: `#${i + 1 + page}` }, i + 1)))))))), ' ', !this.preloader && this.isMobile && (h("button", { class: "button", onClick: () => this.closeModalHandler() }, "Zamknij"))));
|
|
257
|
+
}
|
|
258
|
+
static get is() { return "my-modal"; }
|
|
259
|
+
static get originalStyleUrls() {
|
|
260
|
+
return {
|
|
261
|
+
"$": ["my-modal.scss"]
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
static get styleUrls() {
|
|
265
|
+
return {
|
|
266
|
+
"$": ["my-modal.css"]
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
static get assetsDirs() { return ["assets"]; }
|
|
270
|
+
static get properties() {
|
|
271
|
+
return {
|
|
272
|
+
"shop": {
|
|
273
|
+
"type": "string",
|
|
274
|
+
"mutable": false,
|
|
275
|
+
"complexType": {
|
|
276
|
+
"original": "string",
|
|
277
|
+
"resolved": "string",
|
|
278
|
+
"references": {}
|
|
279
|
+
},
|
|
280
|
+
"required": false,
|
|
281
|
+
"optional": false,
|
|
282
|
+
"docs": {
|
|
283
|
+
"tags": [],
|
|
284
|
+
"text": ""
|
|
285
|
+
},
|
|
286
|
+
"attribute": "shop",
|
|
287
|
+
"reflect": false
|
|
288
|
+
},
|
|
289
|
+
"product": {
|
|
290
|
+
"type": "string",
|
|
291
|
+
"mutable": false,
|
|
292
|
+
"complexType": {
|
|
293
|
+
"original": "string",
|
|
294
|
+
"resolved": "string",
|
|
295
|
+
"references": {}
|
|
296
|
+
},
|
|
297
|
+
"required": false,
|
|
298
|
+
"optional": false,
|
|
299
|
+
"docs": {
|
|
300
|
+
"tags": [],
|
|
301
|
+
"text": ""
|
|
302
|
+
},
|
|
303
|
+
"attribute": "product",
|
|
304
|
+
"reflect": false
|
|
305
|
+
},
|
|
306
|
+
"closeImage": {
|
|
307
|
+
"type": "string",
|
|
308
|
+
"mutable": false,
|
|
309
|
+
"complexType": {
|
|
310
|
+
"original": "string",
|
|
311
|
+
"resolved": "string",
|
|
312
|
+
"references": {}
|
|
313
|
+
},
|
|
314
|
+
"required": false,
|
|
315
|
+
"optional": false,
|
|
316
|
+
"docs": {
|
|
317
|
+
"tags": [],
|
|
318
|
+
"text": ""
|
|
319
|
+
},
|
|
320
|
+
"attribute": "close-image",
|
|
321
|
+
"reflect": false,
|
|
322
|
+
"defaultValue": "'close.png'"
|
|
323
|
+
},
|
|
324
|
+
"arrowDown": {
|
|
325
|
+
"type": "string",
|
|
326
|
+
"mutable": false,
|
|
327
|
+
"complexType": {
|
|
328
|
+
"original": "string",
|
|
329
|
+
"resolved": "string",
|
|
330
|
+
"references": {}
|
|
331
|
+
},
|
|
332
|
+
"required": false,
|
|
333
|
+
"optional": false,
|
|
334
|
+
"docs": {
|
|
335
|
+
"tags": [],
|
|
336
|
+
"text": ""
|
|
337
|
+
},
|
|
338
|
+
"attribute": "arrow-down",
|
|
339
|
+
"reflect": false,
|
|
340
|
+
"defaultValue": "'arrow_down.png'"
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
static get states() {
|
|
345
|
+
return {
|
|
346
|
+
"chunksNum": {},
|
|
347
|
+
"data": {},
|
|
348
|
+
"preloader": {},
|
|
349
|
+
"loading": {},
|
|
350
|
+
"colors": {},
|
|
351
|
+
"currentColor": {},
|
|
352
|
+
"currentIndex": {},
|
|
353
|
+
"infoBoxWidth": {},
|
|
354
|
+
"boxWidth": {},
|
|
355
|
+
"padding": {},
|
|
356
|
+
"isMobile": {},
|
|
357
|
+
"showRange": {},
|
|
358
|
+
"colorCategories": {},
|
|
359
|
+
"selectedCategory": {},
|
|
360
|
+
"page": {}
|
|
361
|
+
};
|
|
362
|
+
}
|
|
363
|
+
static get events() {
|
|
364
|
+
return [{
|
|
365
|
+
"method": "close",
|
|
366
|
+
"name": "close",
|
|
367
|
+
"bubbles": true,
|
|
368
|
+
"cancelable": true,
|
|
369
|
+
"composed": true,
|
|
370
|
+
"docs": {
|
|
371
|
+
"tags": [],
|
|
372
|
+
"text": ""
|
|
373
|
+
},
|
|
374
|
+
"complexType": {
|
|
375
|
+
"original": "any",
|
|
376
|
+
"resolved": "any",
|
|
377
|
+
"references": {}
|
|
378
|
+
}
|
|
379
|
+
}, {
|
|
380
|
+
"method": "readyToCLose",
|
|
381
|
+
"name": "readyToCLose",
|
|
382
|
+
"bubbles": true,
|
|
383
|
+
"cancelable": true,
|
|
384
|
+
"composed": true,
|
|
385
|
+
"docs": {
|
|
386
|
+
"tags": [],
|
|
387
|
+
"text": ""
|
|
388
|
+
},
|
|
389
|
+
"complexType": {
|
|
390
|
+
"original": "any",
|
|
391
|
+
"resolved": "any",
|
|
392
|
+
"references": {}
|
|
393
|
+
}
|
|
394
|
+
}];
|
|
395
|
+
}
|
|
396
|
+
static get methods() {
|
|
397
|
+
return {
|
|
398
|
+
"open": {
|
|
399
|
+
"complexType": {
|
|
400
|
+
"signature": "() => Promise<void>",
|
|
401
|
+
"parameters": [],
|
|
402
|
+
"references": {
|
|
403
|
+
"Promise": {
|
|
404
|
+
"location": "global"
|
|
405
|
+
}
|
|
406
|
+
},
|
|
407
|
+
"return": "Promise<void>"
|
|
408
|
+
},
|
|
409
|
+
"docs": {
|
|
410
|
+
"text": "",
|
|
411
|
+
"tags": []
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
static get elementRef() { return "modalEl"; }
|
|
417
|
+
static get watchers() {
|
|
418
|
+
return [{
|
|
419
|
+
"propName": "chunksNum",
|
|
420
|
+
"methodName": "setInfoBoxWidth"
|
|
421
|
+
}, {
|
|
422
|
+
"propName": "data",
|
|
423
|
+
"methodName": "watchPropHandler"
|
|
424
|
+
}];
|
|
425
|
+
}
|
|
426
|
+
static get listeners() {
|
|
427
|
+
return [{
|
|
428
|
+
"name": "closeInfoBox",
|
|
429
|
+
"method": "closeInfoBoxHandler",
|
|
430
|
+
"target": undefined,
|
|
431
|
+
"capture": false,
|
|
432
|
+
"passive": false
|
|
433
|
+
}, {
|
|
434
|
+
"name": "resize",
|
|
435
|
+
"method": "handleResize",
|
|
436
|
+
"target": "window",
|
|
437
|
+
"capture": false,
|
|
438
|
+
"passive": true
|
|
439
|
+
}, {
|
|
440
|
+
"name": "searchColors",
|
|
441
|
+
"method": "searchColorsHandler",
|
|
442
|
+
"target": undefined,
|
|
443
|
+
"capture": false,
|
|
444
|
+
"passive": false
|
|
445
|
+
}];
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
//# sourceMappingURL=my-modal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"my-modal.js","sourceRoot":"","sources":["../../../src/components/my-modal/my-modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAgB,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM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I,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACrB,CAAC,EACD,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,IAEtB,CAAC,GAAG,CAAC,CACD,CACR,CAAC,CACE,CACP,CACG,CACP,CACG;MAAC,GAAG;MACT,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,QAAQ,IAAI,CACnC,cAAQ,KAAK,EAAC,QAAQ,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAAE,cAErD,CACV,CACG,CACP,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Method, Element, Prop, Event, EventEmitter, h, State, getAssetPath, Listen, Watch } from '@stencil/core';\nimport { ApiService } from '../api';\nimport { setDataLayer } from '../../gtmUtils';\nimport { Color, Data, PaginationData, Product, Shop } from '../../types';\nimport { fetchCategoryColorsQuery, fetchColorByNumber, fetchProductColorsQuery } from '../api/services';\n\ndeclare global {\n interface Window {\n dataLayer: Record<string, any>[];\n }\n}\n\n@Component({\n tag: 'my-modal',\n styleUrl: 'my-modal.scss',\n assetsDirs: ['assets'],\n})\nexport class MyModal {\n private boxDesktopWidth = 130;\n private boxMobileWidth = 85;\n private desktopPadding = 75;\n private mobilePadding = 35;\n private mediumBreakpoint = 1024;\n private colorTimerInterval: ReturnType<typeof setInterval> | undefined;\n // private observer: IntersectionObserver;\n\n @Element() modalEl: HTMLElement;\n\n @Prop() shop: string;\n @Prop() product: string;\n @Prop() closeImage = 'close.png';\n @Prop() arrowDown = 'arrow_down.png';\n\n @State() chunksNum = 12;\n @State() data: Product | null = null;\n @State() preloader = false;\n @State() loading = false;\n @State() colors: PaginationData<Color> | null = null;\n @State() currentColor: Color | null = null;\n @State() currentIndex: number | null = null;\n @State() infoBoxWidth: number | null = null;\n @State() boxWidth: number = this.boxDesktopWidth; // box width with gap\n @State() padding: number = this.desktopPadding;\n @State() isMobile: boolean = false;\n @State() showRange: boolean = false;\n @State() colorCategories: string[] | null = null;\n @State() selectedCategory: any = null;\n @State() page = 1;\n\n @Watch('chunksNum')\n setInfoBoxWidth(newValue: number) {\n this.infoBoxWidth = newValue * this.boxWidth;\n }\n\n @Watch('data')\n watchPropHandler(newValue: Product) {\n if (newValue.categories.data.length > 0) {\n this.showRange = true;\n this.handleCategoryClick(newValue.categories.data[0]);\n } else {\n this.fetchProductColors(String(newValue.id));\n }\n }\n\n private clearInterval = () => {\n this.colorTimerInterval && clearInterval(this.colorTimerInterval);\n this.colorTimerInterval = undefined;\n };\n\n private colorTimer = () => {\n if (this.currentColor && this.currentColor.id) {\n this.colorTimerInterval = setInterval(() => {\n this.currentColor?.name &&\n setDataLayer({\n event: 'ColorTimer',\n shop: this.shop,\n product: this.product,\n color: this.currentColor?.name,\n timer: '10',\n });\n }, 10000);\n } else {\n this.clearInterval();\n }\n };\n\n @Method()\n async open() {\n this.modalEl.style.display = 'block';\n }\n @Event() close: EventEmitter;\n closeModalHandler() {\n this.close.emit();\n }\n\n @Event() readyToCLose: EventEmitter;\n handleReadyToClose(value: boolean) {\n this.readyToCLose.emit({ observable: value });\n }\n\n @Listen('closeInfoBox')\n closeInfoBoxHandler() {\n this.currentColor = null;\n this.currentIndex = null;\n }\n\n private chunks = (xs: Color[], y: Color[][] = []): Color[][] => {\n return xs.length === 0 ? y : this.chunks(xs.slice(this.chunksNum), y.concat([xs.slice(0, this.chunksNum)]));\n };\n\n private calculateBoxCount = () => {\n const modalWidth = this.modalEl.children && this.modalEl.children[0] && this.modalEl.children[0]?.clientWidth - this.padding;\n const boxWidth = this.boxWidth;\n\n const calc = Math.floor(modalWidth / boxWidth);\n\n const boxesCount = calc;\n\n if (!this.preloader) this.chunksNum = boxesCount;\n };\n\n private displayForMobile = () => {\n if (window.innerWidth < this.mediumBreakpoint) {\n this.boxWidth = this.boxMobileWidth;\n this.padding = this.mobilePadding;\n this.isMobile = true;\n } else {\n this.isMobile = false;\n this.boxWidth = this.boxDesktopWidth;\n this.padding = this.desktopPadding;\n }\n };\n\n @Listen('resize', { target: 'window' })\n handleResize() {\n this.calculateBoxCount();\n this.displayForMobile();\n }\n\n private fetchProductData = async () => {\n try {\n const response = await ApiService.getData(\n `products?populate[0]=modalLogo&populate[1]=images&populate[2]=shops&populate[3]=categories&filters[name][$contains]=${this.product}`,\n );\n\n if (response) {\n if (response.data[0].attributes.shops.data.find((shop: Data<Shop>) => shop.attributes.name === this.shop).id) {\n this.data = {\n ...response.data[0].attributes,\n id: response.data[0].id,\n };\n }\n }\n } catch (error) {\n console.error(error);\n } finally {\n this.preloader = false;\n }\n };\n\n // TODO:\n\n private fetchProductColors = async (id: string, page?: number) => {\n this.loading = true;\n\n try {\n const response = await ApiService.getData(`colors?${fetchProductColorsQuery(id, page)}`);\n if (response) {\n this.colors = {\n list:\n response &&\n response.data &&\n response.data.map((item: Data<Color>) => ({\n id: item.id,\n ...item.attributes,\n })),\n pagination: response.meta.pagination,\n };\n }\n } catch (error) {\n console.error(error);\n } finally {\n this.loading = false;\n }\n };\n\n private fetchCategoryColors = async (color: Color) => {\n this.loading = true;\n\n try {\n const response = await ApiService.getData(`colors?${fetchCategoryColorsQuery(color)}`);\n if (response) {\n this.colors = {\n list:\n response &&\n response.data &&\n response.data.map((item: Data<Color>) => ({\n id: item.id,\n ...item.attributes,\n })),\n pagination: response.meta.pagination,\n };\n }\n } catch (error) {\n console.error(error);\n } finally {\n this.loading = false;\n }\n };\n\n @Listen('searchColors')\n async searchColorsHandler(event: CustomEvent) {\n // if search is empty set to first category to not showing whole product colors\n if (event.detail === '') {\n this.handleCategoryClick(this.data?.categories.data[0]);\n }\n\n try {\n if (this.data && this.data.id && event.detail !== '') {\n this.selectedCategory = null;\n const response = await ApiService.getData(`colors?${fetchColorByNumber(Number(this.data.id), event.detail)}`);\n if (response) {\n this.colors = {\n list:\n response &&\n response.data &&\n response.data.map((item: Data<Color>) => ({\n id: item.id,\n ...item.attributes,\n })),\n pagination: response.meta.pagination,\n };\n }\n }\n } catch (error) {\n console.error(error);\n }\n }\n\n // private onIntersection = async (entries: any) => {\n // console.log(entries[0]);\n // if (entries[0].intersectionRatio === 0) {\n // console.log('d');\n // }\n // };\n\n // private handleObserve = () => {\n // console.log(this.modalEl.shadowRoot);\n // const boxesList: any = (this.modalEl as any).querySelector('.my-modal__wrapper');\n // console.log(boxesList);\n // if (boxesList) {\n // this.observer = new IntersectionObserver(this.onIntersection);\n // this.observer.observe(boxesList);\n // }\n // };\n\n private onPage = (page: number) => {\n this.data && this.fetchProductColors(String(this.data.id), page);\n this.page = page;\n this.currentColor = null;\n this.currentIndex = null;\n };\n\n componentWillLoad() {\n this.preloader = true;\n this.fetchProductData();\n }\n\n componentWillRender() {\n this.displayForMobile();\n this.calculateBoxCount();\n this.colorTimer();\n }\n\n private handleCategoryClick = (color?: Color) => {\n if (this.selectedCategory && color && this.selectedCategory.id === color.id && !this.showRange) {\n this.data && this.fetchProductColors(String(this.data.id));\n this.selectedCategory = null;\n } else {\n color && this.fetchCategoryColors(color);\n this.selectedCategory = color;\n }\n this.currentColor = null;\n };\n\n render() {\n return (\n <div class={`my-modal`} onMouseEnter={() => this.handleReadyToClose(false)} onMouseLeave={() => this.handleReadyToClose(true)}>\n {this.preloader && (\n <div class={'loader'}>\n <my-loader></my-loader>\n </div>\n )}\n {!this.preloader && (\n <button class=\"my-modal__close\" onClick={() => this.closeModalHandler()}>\n <img src={getAssetPath(`./assets/${this.closeImage}`)} alt=\"closebtn\" />\n </button>\n )}\n {!this.preloader && this.data && this.data.modalLogo && <img src={`${this.data?.modalLogo?.data?.attributes?.url}`} alt=\"modal-logo\" />}\n {!this.preloader && (\n <p class=\"my-modal__see-more\">\n {this.data?.modalDescription}\n {/* <img src={getAssetPath(`./assets/${this.arrowDown}`)} alt=\"arrow_down\" /> */}\n </p>\n )}\n {this.showRange && (\n <div class={'categories'}>\n {this.data && <my-search productId={Number(this.data?.id)} isMobile={this.isMobile}></my-search>}\n\n <div class={'categories__container'} style={{ maxWidth: `${this.infoBoxWidth}px` }}>\n {this.data?.categories.data.map((c: Color & { attributes: Color }) => (\n <my-colorbox\n key={c.id}\n onClick={() => this.handleCategoryClick(c)}\n color={c.attributes.hex}\n name={c.attributes.name}\n shop={this.shop}\n product={this.product}\n isCategoryActive={this.selectedCategory?.id === c.id}\n ></my-colorbox>\n ))}\n </div>\n {this.isMobile && (\n <div class={'categories__slide-information'} style={{ width: `${this.infoBoxWidth}px` }}>\n <span>Przewiń w lewo</span>\n <span>Przewiń w prawo</span>\n </div>\n )}\n </div>\n )}\n <div class={'my-modal__wrapper'}>\n {this.loading && <my-loader></my-loader>}\n {!this.loading && this.colors && (\n <div class={'container_boxes'}>\n {this.colors.list.length > 0 ? (\n this.chunks(this.colors.list).map((color: Color[], index: number) => {\n return (\n <div key={index} class=\"boxes\">\n <div class=\"boxes__list\">\n {color.map((c: Color) => (\n <my-colorbox\n key={c.id}\n onClick={() => [\n this.currentColor?.id ? (this.currentColor?.id === c.id ? (this.currentColor = null) : (this.currentColor = c)) : (this.currentColor = c),\n (this.currentIndex = index),\n setDataLayer({\n event: 'ColorClick',\n shop: this.shop,\n product: this.product,\n color: c.name,\n }),\n this.currentColor?.id && this.clearInterval(),\n ]}\n color={c.hex}\n name={c.name}\n isActive={this.currentColor?.id === c.id}\n shop={this.shop}\n product={this.product}\n ></my-colorbox>\n ))}\n </div>\n\n {this.currentColor?.id && index === this.currentIndex && (\n <my-colorinfo\n currentColor={this.currentColor}\n shop={this.shop}\n product={this.product}\n data={this.data}\n isMobile={this.isMobile}\n infoBoxWidth={this.infoBoxWidth}\n ></my-colorinfo>\n )}\n </div>\n );\n })\n ) : (\n <p>Brak wyników</p>\n )}\n {this.colors.pagination.pageCount > 1 && (\n <div class={'pagination'}>\n {Array.from({ length: this.colors.pagination.pageCount }).map((page: any, i) => (\n <span\n class={i + 1 === this.page ? 'current' : ''}\n onClick={e => {\n e.preventDefault();\n this.onPage(i + 1);\n }}\n key={`#${i + 1 + page}`}\n >\n {i + 1}\n </span>\n ))}\n </div>\n )}\n </div>\n )}\n </div>{' '}\n {!this.preloader && this.isMobile && (\n <button class=\"button\" onClick={() => this.closeModalHandler()}>\n Zamknij\n </button>\n )}\n </div>\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg width="21px" height="21px" viewBox="0 0 21 21" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
3
|
+
<title>search (1)</title>
|
|
4
|
+
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
5
|
+
<g id="E_TT-Copy" transform="translate(-670.000000, -275.000000)" fill="#000000" fill-rule="nonzero">
|
|
6
|
+
<g id="Group-11" transform="translate(240.477268, 115.000000)">
|
|
7
|
+
<g id="Group-18" transform="translate(38.010142, 143.000000)">
|
|
8
|
+
<g id="search-(1)" transform="translate(392.266523, 17.349138)">
|
|
9
|
+
<path d="M8.04938507,16.0918365 C9.8370154,16.0918798 11.5735099,15.4954541 12.9838185,14.3969873 L18.3044575,19.7176263 C18.7019302,20.1014916 19.3352777,20.0904844 19.719143,19.6930117 C20.0936046,19.3052895 20.0936046,18.6906196 19.719143,18.3029407 L14.3985041,12.9823018 C17.12426,9.47351771 16.4895258,4.41943508 12.9807417,1.69367909 C9.47195764,-1.03207689 4.41791834,-0.397342671 1.69216235,3.11144142 C-1.03359363,6.62022552 -0.398859411,11.6743081 3.10992468,14.4000641 C4.5225301,15.4974475 6.26058468,16.0927465 8.04938507,16.0918365 Z M3.77430035,3.77274027 C6.13538859,1.4116087 9.96346822,1.41156536 12.3245998,3.7726536 C14.6857314,6.13374184 14.6857747,9.96182148 12.3246865,12.3229531 C9.96359823,14.6840846 6.1355186,14.684128 3.77438702,12.3230397 C3.77434368,12.3229964 3.77434368,12.3229964 3.77430035,12.3229531 C1.41321211,9.97906898 1.39930143,6.16494336 3.7431855,3.80385512 C3.75354267,3.79345461 3.76389984,3.78309744 3.77430035,3.77274027 Z" id="Shape"></path>
|
|
10
|
+
</g>
|
|
11
|
+
</g>
|
|
12
|
+
</g>
|
|
13
|
+
</g>
|
|
14
|
+
</g>
|
|
15
|
+
</svg>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
.pallete-wrapper * {
|
|
2
|
+
font-family: "Galatea", sans-serif;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.search {
|
|
6
|
+
position: relative;
|
|
7
|
+
width: 400px;
|
|
8
|
+
}
|
|
9
|
+
@media (max-width: 768px) {
|
|
10
|
+
.search {
|
|
11
|
+
width: 100%;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
.search input {
|
|
15
|
+
margin-bottom: 12px;
|
|
16
|
+
font-size: 16px;
|
|
17
|
+
padding: 19px;
|
|
18
|
+
border-radius: 27.35px;
|
|
19
|
+
border: 1px solid #dfdfdf;
|
|
20
|
+
width: 100%;
|
|
21
|
+
}
|
|
22
|
+
.search button {
|
|
23
|
+
position: absolute;
|
|
24
|
+
border: none;
|
|
25
|
+
background-color: transparent;
|
|
26
|
+
right: -20px;
|
|
27
|
+
top: 0;
|
|
28
|
+
width: 50px;
|
|
29
|
+
height: calc(100% - 12px);
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
align-items: center;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { h, getAssetPath } from '@stencil/core';
|
|
2
|
+
export class MySearch {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.fetchColorsByName = (text) => {
|
|
5
|
+
this.searchColors.emit(text);
|
|
6
|
+
};
|
|
7
|
+
this.productId = undefined;
|
|
8
|
+
this.isMobile = undefined;
|
|
9
|
+
this.searchIcon = 'search.svg';
|
|
10
|
+
this.searchText = null;
|
|
11
|
+
}
|
|
12
|
+
onInputChangeValue(event) {
|
|
13
|
+
const value = event.target.value;
|
|
14
|
+
this.searchColors.emit(value);
|
|
15
|
+
this.searchText = value;
|
|
16
|
+
}
|
|
17
|
+
fetchColorsByNameHandle(newValue) {
|
|
18
|
+
this.fetchColorsByName(newValue);
|
|
19
|
+
}
|
|
20
|
+
render() {
|
|
21
|
+
return (h("div", { class: 'search' }, h("input", { placeholder: this.isMobile ? 'Wyszukaj kolor' : 'Wyszukaj kolor po nazwie bądź numerze', value: this.searchText || '', type: "text", onInput: this.onInputChangeValue.bind(this) }), h("button", { onClick: () => {
|
|
22
|
+
this.searchText && this.fetchColorsByName(this.searchText);
|
|
23
|
+
this.searchText = '';
|
|
24
|
+
} }, h("img", { src: getAssetPath(`./assets/${this.searchIcon}`), alt: "arrow_down" }))));
|
|
25
|
+
}
|
|
26
|
+
static get is() { return "my-search"; }
|
|
27
|
+
static get encapsulation() { return "scoped"; }
|
|
28
|
+
static get originalStyleUrls() {
|
|
29
|
+
return {
|
|
30
|
+
"$": ["my-search.scss"]
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
static get styleUrls() {
|
|
34
|
+
return {
|
|
35
|
+
"$": ["my-search.css"]
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
static get assetsDirs() { return ["assets"]; }
|
|
39
|
+
static get properties() {
|
|
40
|
+
return {
|
|
41
|
+
"productId": {
|
|
42
|
+
"type": "number",
|
|
43
|
+
"mutable": false,
|
|
44
|
+
"complexType": {
|
|
45
|
+
"original": "number",
|
|
46
|
+
"resolved": "number",
|
|
47
|
+
"references": {}
|
|
48
|
+
},
|
|
49
|
+
"required": false,
|
|
50
|
+
"optional": false,
|
|
51
|
+
"docs": {
|
|
52
|
+
"tags": [],
|
|
53
|
+
"text": ""
|
|
54
|
+
},
|
|
55
|
+
"attribute": "product-id",
|
|
56
|
+
"reflect": false
|
|
57
|
+
},
|
|
58
|
+
"isMobile": {
|
|
59
|
+
"type": "boolean",
|
|
60
|
+
"mutable": false,
|
|
61
|
+
"complexType": {
|
|
62
|
+
"original": "boolean",
|
|
63
|
+
"resolved": "boolean",
|
|
64
|
+
"references": {}
|
|
65
|
+
},
|
|
66
|
+
"required": false,
|
|
67
|
+
"optional": false,
|
|
68
|
+
"docs": {
|
|
69
|
+
"tags": [],
|
|
70
|
+
"text": ""
|
|
71
|
+
},
|
|
72
|
+
"attribute": "is-mobile",
|
|
73
|
+
"reflect": false
|
|
74
|
+
},
|
|
75
|
+
"searchIcon": {
|
|
76
|
+
"type": "string",
|
|
77
|
+
"mutable": false,
|
|
78
|
+
"complexType": {
|
|
79
|
+
"original": "string",
|
|
80
|
+
"resolved": "string",
|
|
81
|
+
"references": {}
|
|
82
|
+
},
|
|
83
|
+
"required": false,
|
|
84
|
+
"optional": false,
|
|
85
|
+
"docs": {
|
|
86
|
+
"tags": [],
|
|
87
|
+
"text": ""
|
|
88
|
+
},
|
|
89
|
+
"attribute": "search-icon",
|
|
90
|
+
"reflect": false,
|
|
91
|
+
"defaultValue": "'search.svg'"
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
static get states() {
|
|
96
|
+
return {
|
|
97
|
+
"searchText": {}
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
static get events() {
|
|
101
|
+
return [{
|
|
102
|
+
"method": "searchColors",
|
|
103
|
+
"name": "searchColors",
|
|
104
|
+
"bubbles": true,
|
|
105
|
+
"cancelable": true,
|
|
106
|
+
"composed": true,
|
|
107
|
+
"docs": {
|
|
108
|
+
"tags": [],
|
|
109
|
+
"text": ""
|
|
110
|
+
},
|
|
111
|
+
"complexType": {
|
|
112
|
+
"original": "any",
|
|
113
|
+
"resolved": "any",
|
|
114
|
+
"references": {}
|
|
115
|
+
}
|
|
116
|
+
}];
|
|
117
|
+
}
|
|
118
|
+
static get watchers() {
|
|
119
|
+
return [{
|
|
120
|
+
"propName": "searchText",
|
|
121
|
+
"methodName": "fetchColorsByNameHandle"
|
|
122
|
+
}];
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=my-search.js.map
|