tee3apps-cms-sdk-react 0.0.31 → 0.0.32
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/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/PageComponents/BoxComponent.tsx +99 -98
- package/src/PageComponents/Visual-Components/GroupImageList.tsx +73 -71
- package/src/PageComponents/Visual-Components/GroupProductComponent.tsx +239 -238
- package/src/PageComponents/Visual-Components/Styles/ProductListViewOne.tsx +34 -33
- package/src/PageComponents/Visual-Components/Styles/ProductListViewTwo.tsx +30 -28
- package/src/PageComponents/Visual-Components/TextComponent.tsx +3 -1
|
@@ -6,12 +6,12 @@ import { Linodeurl } from '../../const';
|
|
|
6
6
|
// Utility function to extract price value from different formats
|
|
7
7
|
const getPriceValue = (price: any): number => {
|
|
8
8
|
if (price === null || price === undefined) return 0;
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
// If it's already a number
|
|
11
11
|
if (typeof price === 'number') {
|
|
12
12
|
return isNaN(price) ? 0 : price;
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
|
|
15
15
|
// If it's an object with $numberDecimal (but not an array)
|
|
16
16
|
if (typeof price === 'object' && price !== null && !Array.isArray(price)) {
|
|
17
17
|
if (price.$numberDecimal !== undefined && price.$numberDecimal !== null) {
|
|
@@ -19,40 +19,40 @@ const getPriceValue = (price: any): number => {
|
|
|
19
19
|
return isNaN(value) ? 0 : value;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
// If it's a string, try to parse it
|
|
24
24
|
if (typeof price === 'string') {
|
|
25
25
|
const value = parseFloat(price);
|
|
26
26
|
return isNaN(value) ? 0 : value;
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
return 0;
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
// Utility function to get price from pricing array (mrp, costPrice, nlcPrice)
|
|
33
33
|
const getPriceFromPricingArray = (pricingArray: any[]): number => {
|
|
34
34
|
if (!Array.isArray(pricingArray) || pricingArray.length === 0) return 0;
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
// First, try to find the default price with default currency
|
|
37
37
|
const defaultPrice = pricingArray.find(
|
|
38
38
|
(item: any) => item.isDefault === true && item.isDefaultCurrency === true
|
|
39
39
|
);
|
|
40
|
-
|
|
40
|
+
|
|
41
41
|
if (defaultPrice && defaultPrice.price) {
|
|
42
42
|
return getPriceValue(defaultPrice.price);
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
|
|
45
45
|
// Fallback: find any default price
|
|
46
46
|
const anyDefault = pricingArray.find((item: any) => item.isDefault === true);
|
|
47
47
|
if (anyDefault && anyDefault.price) {
|
|
48
48
|
return getPriceValue(anyDefault.price);
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
// Fallback: use first item
|
|
52
52
|
if (pricingArray[0] && pricingArray[0].price) {
|
|
53
53
|
return getPriceValue(pricingArray[0].price);
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
|
|
56
56
|
return 0;
|
|
57
57
|
};
|
|
58
58
|
|
|
@@ -60,12 +60,12 @@ const getPriceFromPricingArray = (pricingArray: any[]): number => {
|
|
|
60
60
|
const getProductPrices = (product: any) => {
|
|
61
61
|
// Use pricing object only
|
|
62
62
|
const mrp = product.pricing?.mrp ? getPriceFromPricingArray(product.pricing.mrp) : 0;
|
|
63
|
-
const sellingPrice = product.pricing?.nlcPrice
|
|
64
|
-
? getPriceFromPricingArray(product.pricing.nlcPrice)
|
|
65
|
-
: product.pricing?.costPrice
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
const sellingPrice = product.pricing?.nlcPrice
|
|
64
|
+
? getPriceFromPricingArray(product.pricing.nlcPrice)
|
|
65
|
+
: product.pricing?.costPrice
|
|
66
|
+
? getPriceFromPricingArray(product.pricing.costPrice)
|
|
67
|
+
: 0;
|
|
68
|
+
|
|
69
69
|
return {
|
|
70
70
|
mrp,
|
|
71
71
|
sellingPrice
|
|
@@ -79,7 +79,7 @@ interface Product {
|
|
|
79
79
|
name: string | { all: string };
|
|
80
80
|
image: any;
|
|
81
81
|
isActive: boolean;
|
|
82
|
-
price?:any;
|
|
82
|
+
price?: any;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
interface GroupProductStatic {
|
|
@@ -98,7 +98,7 @@ interface GroupProductDynamic {
|
|
|
98
98
|
interface GroupProductData {
|
|
99
99
|
static: GroupProductStatic;
|
|
100
100
|
dynamic: GroupProductDynamic;
|
|
101
|
-
|
|
101
|
+
showItems: Product[]
|
|
102
102
|
|
|
103
103
|
}
|
|
104
104
|
|
|
@@ -128,18 +128,19 @@ export interface GroupProductComponentProps {
|
|
|
128
128
|
headerText: any;
|
|
129
129
|
type: string;
|
|
130
130
|
groupproduct: GroupProductData;
|
|
131
|
-
showItems:Product[]
|
|
131
|
+
showItems: Product[]
|
|
132
132
|
activeStatus: boolean;
|
|
133
133
|
headerImage: string;
|
|
134
134
|
selectedProducts: Product[];
|
|
135
135
|
items: any[];
|
|
136
136
|
|
|
137
137
|
cardColor: string;
|
|
138
|
+
carouselBackground: string;
|
|
138
139
|
showProductName: DeviceBooleanProps;
|
|
139
140
|
headerTextStyle: HeaderTextStyle;
|
|
140
141
|
layout: DeviceLayoutProps;
|
|
141
142
|
style: DeviceLayoutProps;
|
|
142
|
-
|
|
143
|
+
|
|
143
144
|
showHeader: DeviceBooleanProps;
|
|
144
145
|
isHorizontalScroll: DeviceBooleanProps;
|
|
145
146
|
headerBackground: string;
|
|
@@ -151,12 +152,12 @@ interface GroupProductComponentMainProps {
|
|
|
151
152
|
deviceMode?: string;
|
|
152
153
|
}
|
|
153
154
|
|
|
154
|
-
const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
|
|
155
|
-
props,
|
|
156
|
-
deviceMode = 'web'
|
|
155
|
+
const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
|
|
156
|
+
props,
|
|
157
|
+
deviceMode = 'web'
|
|
157
158
|
}) => {
|
|
158
159
|
const getCurrentBooleanProp = (prop: DeviceBooleanProps) => {
|
|
159
|
-
switch(deviceMode) {
|
|
160
|
+
switch (deviceMode) {
|
|
160
161
|
case 'mobileweb': return prop.mobileweb;
|
|
161
162
|
case 'mobileapp': return prop.mobileapp;
|
|
162
163
|
case 'tablet': return prop.tablet;
|
|
@@ -166,7 +167,7 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
|
|
|
166
167
|
};
|
|
167
168
|
|
|
168
169
|
const getCurrentLayout = () => {
|
|
169
|
-
switch(deviceMode) {
|
|
170
|
+
switch (deviceMode) {
|
|
170
171
|
case 'mobileweb': return props.layout.mobileweb;
|
|
171
172
|
case 'mobileapp': return props.layout.mobileapp;
|
|
172
173
|
case 'tablet': return props.layout.tablet;
|
|
@@ -175,8 +176,8 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
|
|
|
175
176
|
}
|
|
176
177
|
};
|
|
177
178
|
|
|
178
|
-
|
|
179
|
-
switch(deviceMode) {
|
|
179
|
+
const getCurrentStyle = () => {
|
|
180
|
+
switch (deviceMode) {
|
|
180
181
|
case 'mobileweb': return props.style.mobileweb;
|
|
181
182
|
case 'mobileapp': return props.style.mobileapp;
|
|
182
183
|
case 'tablet': return props.style.tablet;
|
|
@@ -188,33 +189,33 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
|
|
|
188
189
|
const showProductName = getCurrentBooleanProp(props.showProductName);
|
|
189
190
|
const isHorizontalScroll = getCurrentBooleanProp(props.isHorizontalScroll);
|
|
190
191
|
const currentLayout = getCurrentLayout();
|
|
191
|
-
const currentstyle=getCurrentStyle();
|
|
192
|
+
const currentstyle = getCurrentStyle();
|
|
192
193
|
|
|
193
194
|
const getProducts = () => {
|
|
194
|
-
if(props?.groupproduct?.showItems) return props.groupproduct.showItems
|
|
195
|
+
if (props?.groupproduct?.showItems) return props.groupproduct.showItems
|
|
195
196
|
return [];
|
|
196
197
|
};
|
|
197
198
|
|
|
198
199
|
const products = getProducts();
|
|
199
|
-
|
|
200
|
+
|
|
200
201
|
// Helper function to render product based on style
|
|
201
202
|
const renderProduct = (product: Product, key: string) => {
|
|
202
203
|
if (currentstyle === 'STYLE1') {
|
|
203
204
|
return (
|
|
204
205
|
<div key={key}>
|
|
205
|
-
<ProductListViewOne props={product} />
|
|
206
|
+
<ProductListViewOne props={product} cardColor={props.cardColor} />
|
|
206
207
|
</div>
|
|
207
208
|
);
|
|
208
209
|
} else if (currentstyle === 'STYLE2') {
|
|
209
210
|
return (
|
|
210
211
|
<div key={key}>
|
|
211
|
-
<ProductListViewTwo props={product} />
|
|
212
|
+
<ProductListViewTwo props={product} cardColor={props.cardColor} />
|
|
212
213
|
</div>
|
|
213
214
|
);
|
|
214
215
|
} else {
|
|
215
216
|
// Default style (NONE) - inline JSX
|
|
216
217
|
return (
|
|
217
|
-
<a href={`/${product.code}`} target={'_blank'} rel="noopener noreferrer" style={{textDecoration:"none"}} key={key}>
|
|
218
|
+
<a href={`/${product.code}`} target={'_blank'} rel="noopener noreferrer" style={{ textDecoration: "none" }} key={key}>
|
|
218
219
|
<div
|
|
219
220
|
className="productImageSlide"
|
|
220
221
|
style={{
|
|
@@ -223,7 +224,7 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
|
|
|
223
224
|
borderRadius: '8px',
|
|
224
225
|
overflow: 'hidden',
|
|
225
226
|
border: '1px solid #eee',
|
|
226
|
-
backgroundColor: '#fff',
|
|
227
|
+
backgroundColor: props.cardColor || '#fff',
|
|
227
228
|
display: 'flex',
|
|
228
229
|
flexDirection: 'column',
|
|
229
230
|
alignItems: 'center',
|
|
@@ -297,13 +298,13 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
|
|
|
297
298
|
if (currentstyle === 'STYLE1') {
|
|
298
299
|
return (
|
|
299
300
|
<div key={key}>
|
|
300
|
-
<ProductListViewOne props={product} />
|
|
301
|
+
<ProductListViewOne props={product} cardColor={props.cardColor} />
|
|
301
302
|
</div>
|
|
302
303
|
);
|
|
303
304
|
} else if (currentstyle === 'STYLE2') {
|
|
304
305
|
return (
|
|
305
306
|
<div key={key}>
|
|
306
|
-
<ProductListViewTwo props={product} />
|
|
307
|
+
<ProductListViewTwo props={product} cardColor={props.cardColor} />
|
|
307
308
|
</div>
|
|
308
309
|
);
|
|
309
310
|
} else {
|
|
@@ -317,7 +318,7 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
|
|
|
317
318
|
borderRadius: '8px',
|
|
318
319
|
overflow: 'hidden',
|
|
319
320
|
border: '1px solid #eee',
|
|
320
|
-
backgroundColor: '#fff',
|
|
321
|
+
backgroundColor: props.cardColor || '#fff',
|
|
321
322
|
display: 'flex',
|
|
322
323
|
flexDirection: 'column',
|
|
323
324
|
alignItems: 'center',
|
|
@@ -341,11 +342,11 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
|
|
|
341
342
|
}
|
|
342
343
|
}}
|
|
343
344
|
>
|
|
344
|
-
<div style={{
|
|
345
|
-
height: imageHeight,
|
|
346
|
-
width: '100%',
|
|
347
|
-
display: 'flex',
|
|
348
|
-
alignItems: 'center',
|
|
345
|
+
<div style={{
|
|
346
|
+
height: imageHeight,
|
|
347
|
+
width: '100%',
|
|
348
|
+
display: 'flex',
|
|
349
|
+
alignItems: 'center',
|
|
349
350
|
justifyContent: 'center',
|
|
350
351
|
marginBottom: '8px'
|
|
351
352
|
}}>
|
|
@@ -355,7 +356,7 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
|
|
|
355
356
|
style={{ width: '100%', height: '100%', objectFit: 'contain' }}
|
|
356
357
|
/>
|
|
357
358
|
</div>
|
|
358
|
-
{showProductName && <div style={{
|
|
359
|
+
{showProductName && <div style={{
|
|
359
360
|
textAlign: 'center',
|
|
360
361
|
fontSize: fontSize,
|
|
361
362
|
fontWeight: fontWeight,
|
|
@@ -375,7 +376,7 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
|
|
|
375
376
|
);
|
|
376
377
|
}
|
|
377
378
|
};
|
|
378
|
-
|
|
379
|
+
|
|
379
380
|
// Carousel navigation functions
|
|
380
381
|
const scrollLeft = () => {
|
|
381
382
|
const carousel = document.querySelector('.groupProductCarousel');
|
|
@@ -414,225 +415,225 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
|
|
|
414
415
|
<div
|
|
415
416
|
style={{
|
|
416
417
|
border: '1px solid #e1e1e1',
|
|
417
|
-
width: '100%',
|
|
418
|
+
width: '100%',
|
|
418
419
|
maxWidth: '100%',
|
|
419
420
|
borderRadius: '0px',
|
|
420
421
|
minHeight: '100px',
|
|
421
422
|
position: 'relative',
|
|
422
423
|
overflow: 'hidden',
|
|
423
|
-
marginBottom:'20px',
|
|
424
|
-
marginTop:'0px'
|
|
425
|
-
|
|
424
|
+
marginBottom: '20px',
|
|
425
|
+
marginTop: '0px'
|
|
426
|
+
|
|
426
427
|
}}
|
|
427
428
|
className='GroupProductComponent'
|
|
428
429
|
>
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
430
|
+
{showHeader && (
|
|
431
|
+
<div
|
|
432
|
+
className="groupProductHeader"
|
|
433
|
+
style={{
|
|
434
|
+
backgroundColor: props.headerBackground,
|
|
435
|
+
padding: '12px 16px',
|
|
436
|
+
borderRadius: '0px',
|
|
437
|
+
marginBottom: '4px',
|
|
438
|
+
display: 'flex',
|
|
439
|
+
alignItems: 'center',
|
|
440
|
+
justifyContent: 'space-between',
|
|
441
|
+
flexWrap: 'wrap',
|
|
442
|
+
gap: '12px',
|
|
443
|
+
}}
|
|
444
|
+
>
|
|
445
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>
|
|
446
|
+
{props.headerImage && (
|
|
447
|
+
<div style={{ width: '32px', height: '32px' }}>
|
|
448
|
+
{/* <ImageDisplayComponent
|
|
448
449
|
fileUrl={props.headerImage}
|
|
449
450
|
preserveAspectRatio={true}
|
|
450
451
|
maxWidth="100%"
|
|
451
452
|
maxHeight="32px"
|
|
452
453
|
/> */}
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
454
|
+
<img
|
|
455
|
+
src={`${Linodeurl}${props.headerImage}`}
|
|
456
|
+
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
|
|
457
|
+
/>
|
|
458
|
+
</div>
|
|
459
|
+
)}
|
|
460
|
+
<p style={{
|
|
461
|
+
color: props.headerTextStyle.fontColor,
|
|
462
|
+
fontSize: `${props.headerTextStyle.fontSize}px`,
|
|
463
|
+
fontWeight: props.headerTextStyle.isBold ? 'bold' : 'normal',
|
|
464
|
+
fontStyle: props.headerTextStyle.isItalic ? 'italic' : 'normal',
|
|
465
|
+
textDecoration: props.headerTextStyle.isUnderline ? 'underline' : 'none',
|
|
466
|
+
margin: 0
|
|
467
|
+
}}>
|
|
468
|
+
{props.headerText?.all || props?.headerText}
|
|
469
|
+
</p>
|
|
470
|
+
</div>
|
|
470
471
|
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
style={{
|
|
479
|
-
color: 'black',
|
|
480
|
-
textDecoration: 'none',
|
|
481
|
-
fontWeight: '500',
|
|
482
|
-
fontSize: '14px',
|
|
483
|
-
padding: '6px 12px',
|
|
484
|
-
border: 'none',
|
|
485
|
-
borderRadius: '4px',
|
|
486
|
-
backgroundColor: 'transparent',
|
|
487
|
-
cursor: 'pointer'
|
|
488
|
-
}}
|
|
489
|
-
>
|
|
490
|
-
View All
|
|
491
|
-
</a>
|
|
492
|
-
)}
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
{currentLayout === 'NONE' && (
|
|
498
|
-
<div style={{ display: 'flex', gap: '8px' }}>
|
|
499
|
-
<button
|
|
500
|
-
onClick={scrollLeft}
|
|
501
|
-
style={{
|
|
502
|
-
width: '32px',
|
|
503
|
-
height: '32px',
|
|
504
|
-
borderRadius: '50%',
|
|
505
|
-
border: '1px solid #ddd',
|
|
506
|
-
backgroundColor: '#fff',
|
|
507
|
-
cursor: 'pointer',
|
|
508
|
-
display: 'flex',
|
|
509
|
-
alignItems: 'center',
|
|
510
|
-
justifyContent: 'center',
|
|
511
|
-
fontSize: '16px',
|
|
512
|
-
fontWeight: 'bold'
|
|
513
|
-
}}
|
|
514
|
-
onMouseOver={(e) => {
|
|
515
|
-
e.currentTarget.style.backgroundColor = '#f8f9fa';
|
|
516
|
-
}}
|
|
517
|
-
onMouseOut={(e) => {
|
|
518
|
-
e.currentTarget.style.backgroundColor = '#fff';
|
|
519
|
-
}}
|
|
520
|
-
>
|
|
521
|
-
‹
|
|
522
|
-
</button>
|
|
523
|
-
<button
|
|
524
|
-
onClick={scrollRight}
|
|
472
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '16px' }}>
|
|
473
|
+
|
|
474
|
+
{props.type == 'static' && (
|
|
475
|
+
<a
|
|
476
|
+
href={`/search/${props.groupproduct.static.code}`}
|
|
477
|
+
target="_blank"
|
|
478
|
+
rel="noopener noreferrer"
|
|
525
479
|
style={{
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
fontSize: '16px',
|
|
536
|
-
fontWeight: 'bold'
|
|
537
|
-
}}
|
|
538
|
-
onMouseOver={(e) => {
|
|
539
|
-
e.currentTarget.style.backgroundColor = '#f8f9fa';
|
|
540
|
-
}}
|
|
541
|
-
onMouseOut={(e) => {
|
|
542
|
-
e.currentTarget.style.backgroundColor = '#fff';
|
|
480
|
+
color: 'black',
|
|
481
|
+
textDecoration: 'none',
|
|
482
|
+
fontWeight: '500',
|
|
483
|
+
fontSize: '14px',
|
|
484
|
+
padding: '6px 12px',
|
|
485
|
+
border: 'none',
|
|
486
|
+
borderRadius: '4px',
|
|
487
|
+
backgroundColor: 'transparent',
|
|
488
|
+
cursor: 'pointer'
|
|
543
489
|
}}
|
|
544
490
|
>
|
|
545
|
-
|
|
546
|
-
</
|
|
547
|
-
</div>
|
|
548
|
-
)}
|
|
549
|
-
</div>
|
|
550
|
-
</div>
|
|
551
|
-
)}
|
|
552
|
-
|
|
553
|
-
<div
|
|
554
|
-
className="groupProductCarousel"
|
|
555
|
-
style={{
|
|
556
|
-
display: currentLayout === 'NONE' ? 'flex' : 'block',
|
|
557
|
-
overflowX: currentLayout === 'NONE' && isHorizontalScroll ? 'scroll' : 'visible',
|
|
558
|
-
overflowY: 'hidden',
|
|
559
|
-
gap: currentLayout === 'NONE' ? '12px' : '0',
|
|
560
|
-
padding: '12px',
|
|
561
|
-
scrollBehavior: 'smooth',
|
|
562
|
-
backgroundColor: props.cardColor || '#fff',
|
|
563
|
-
scrollbarWidth: 'thin',
|
|
564
|
-
borderRadius: '8px',
|
|
565
|
-
position: 'relative',
|
|
566
|
-
scrollbarColor: '#c1c1c1 #f0f0f0',
|
|
567
|
-
width: '100%',
|
|
568
|
-
...(currentLayout === 'NONE' && isHorizontalScroll ? {
|
|
569
|
-
// Webkit scrollbar styles for Chrome/Safari
|
|
570
|
-
WebkitOverflowScrolling: 'touch',
|
|
571
|
-
} : {})
|
|
572
|
-
}}
|
|
573
|
-
>
|
|
574
|
-
{products.length > 0 ? (
|
|
575
|
-
currentLayout === 'NONE' ? (
|
|
576
|
-
products.slice(0, props.type === 'static' ? 15 : products.length).map((product) =>
|
|
577
|
-
renderProduct(product, product._id)
|
|
578
|
-
)
|
|
579
|
-
) : currentLayout === 'SMALL' ? (
|
|
580
|
-
<div style={{
|
|
581
|
-
display: 'grid',
|
|
582
|
-
gridTemplateColumns: 'repeat(2, 1fr)',
|
|
583
|
-
gap: '16px',
|
|
584
|
-
padding: '8px'
|
|
585
|
-
}}>
|
|
586
|
-
{
|
|
587
|
-
products.map((product) =>
|
|
588
|
-
renderProductCard(product, product._id, '100px', '12px', '32px')
|
|
491
|
+
View All
|
|
492
|
+
</a>
|
|
589
493
|
)}
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
{currentLayout === 'NONE' && (
|
|
499
|
+
<div style={{ display: 'flex', gap: '8px' }}>
|
|
500
|
+
<button
|
|
501
|
+
onClick={scrollLeft}
|
|
502
|
+
style={{
|
|
503
|
+
width: '32px',
|
|
504
|
+
height: '32px',
|
|
505
|
+
borderRadius: '50%',
|
|
506
|
+
border: '1px solid #ddd',
|
|
507
|
+
backgroundColor: '#fff',
|
|
508
|
+
cursor: 'pointer',
|
|
509
|
+
display: 'flex',
|
|
510
|
+
alignItems: 'center',
|
|
511
|
+
justifyContent: 'center',
|
|
512
|
+
fontSize: '16px',
|
|
513
|
+
fontWeight: 'bold'
|
|
514
|
+
}}
|
|
515
|
+
onMouseOver={(e) => {
|
|
516
|
+
e.currentTarget.style.backgroundColor = '#f8f9fa';
|
|
517
|
+
}}
|
|
518
|
+
onMouseOut={(e) => {
|
|
519
|
+
e.currentTarget.style.backgroundColor = '#fff';
|
|
520
|
+
}}
|
|
521
|
+
>
|
|
522
|
+
‹
|
|
523
|
+
</button>
|
|
524
|
+
<button
|
|
525
|
+
onClick={scrollRight}
|
|
526
|
+
style={{
|
|
527
|
+
width: '32px',
|
|
528
|
+
height: '32px',
|
|
529
|
+
borderRadius: '50%',
|
|
530
|
+
border: '1px solid #ddd',
|
|
531
|
+
backgroundColor: '#fff',
|
|
532
|
+
cursor: 'pointer',
|
|
533
|
+
display: 'flex',
|
|
534
|
+
alignItems: 'center',
|
|
535
|
+
justifyContent: 'center',
|
|
536
|
+
fontSize: '16px',
|
|
537
|
+
fontWeight: 'bold'
|
|
538
|
+
}}
|
|
539
|
+
onMouseOver={(e) => {
|
|
540
|
+
e.currentTarget.style.backgroundColor = '#f8f9fa';
|
|
541
|
+
}}
|
|
542
|
+
onMouseOut={(e) => {
|
|
543
|
+
e.currentTarget.style.backgroundColor = '#fff';
|
|
544
|
+
}}
|
|
545
|
+
>
|
|
546
|
+
›
|
|
547
|
+
</button>
|
|
617
548
|
</div>
|
|
618
549
|
)}
|
|
619
550
|
</div>
|
|
620
|
-
) : null
|
|
621
|
-
) : (
|
|
622
|
-
<div style={{
|
|
623
|
-
textAlign: 'center',
|
|
624
|
-
color: '#666',
|
|
625
|
-
padding: '40px',
|
|
626
|
-
width: '100%',
|
|
627
|
-
border: '2px dashed #ddd',
|
|
628
|
-
borderRadius: '8px',
|
|
629
|
-
backgroundColor: '#f9f9f9'
|
|
630
|
-
}}>
|
|
631
|
-
<p>No products selected. Use settings to add products.</p>
|
|
632
551
|
</div>
|
|
633
552
|
)}
|
|
553
|
+
|
|
554
|
+
<div
|
|
555
|
+
className="groupProductCarousel"
|
|
556
|
+
style={{
|
|
557
|
+
display: currentLayout === 'NONE' ? 'flex' : 'block',
|
|
558
|
+
overflowX: currentLayout === 'NONE' && isHorizontalScroll ? 'scroll' : 'visible',
|
|
559
|
+
overflowY: 'hidden',
|
|
560
|
+
gap: currentLayout === 'NONE' ? '12px' : '0',
|
|
561
|
+
padding: '12px',
|
|
562
|
+
scrollBehavior: 'smooth',
|
|
563
|
+
backgroundColor: props.carouselBackground || '#fff',
|
|
564
|
+
scrollbarWidth: 'thin',
|
|
565
|
+
borderRadius: '8px',
|
|
566
|
+
position: 'relative',
|
|
567
|
+
scrollbarColor: '#c1c1c1 #f0f0f0',
|
|
568
|
+
width: '100%',
|
|
569
|
+
...(currentLayout === 'NONE' && isHorizontalScroll ? {
|
|
570
|
+
// Webkit scrollbar styles for Chrome/Safari
|
|
571
|
+
WebkitOverflowScrolling: 'touch',
|
|
572
|
+
} : {})
|
|
573
|
+
}}
|
|
574
|
+
>
|
|
575
|
+
{products.length > 0 ? (
|
|
576
|
+
currentLayout === 'NONE' ? (
|
|
577
|
+
products.slice(0, props.type === 'static' ? 15 : products.length).map((product) =>
|
|
578
|
+
renderProduct(product, product._id)
|
|
579
|
+
)
|
|
580
|
+
) : currentLayout === 'SMALL' ? (
|
|
581
|
+
<div style={{
|
|
582
|
+
display: 'grid',
|
|
583
|
+
gridTemplateColumns: 'repeat(2, 1fr)',
|
|
584
|
+
gap: '16px',
|
|
585
|
+
padding: '8px'
|
|
586
|
+
}}>
|
|
587
|
+
{
|
|
588
|
+
products.map((product) =>
|
|
589
|
+
renderProductCard(product, product._id, '100px', '12px', '32px')
|
|
590
|
+
)}
|
|
591
|
+
</div>
|
|
592
|
+
) : currentLayout === 'MEDIUM' ? (
|
|
593
|
+
<div style={{
|
|
594
|
+
display: 'grid',
|
|
595
|
+
gridTemplateColumns: 'repeat(3, 1fr)',
|
|
596
|
+
gap: '16px',
|
|
597
|
+
padding: '8px'
|
|
598
|
+
}}>
|
|
599
|
+
{
|
|
600
|
+
products.map((product) =>
|
|
601
|
+
renderProductCard(product, product._id, '120px', '14px', '40px')
|
|
602
|
+
)}
|
|
603
|
+
</div>
|
|
604
|
+
) : currentLayout === 'MEDIUM_THREE' ? (
|
|
605
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '16px', padding: '8px' }}>
|
|
606
|
+
{products.length > 0 && (
|
|
607
|
+
renderProductCard(products[0], products[0]._id, '160px', '16px', 'auto', '600')
|
|
608
|
+
)}
|
|
609
|
+
{products.length > 1 && (
|
|
610
|
+
<div style={{
|
|
611
|
+
display: 'grid',
|
|
612
|
+
gridTemplateColumns: 'repeat(2,1fr)',
|
|
613
|
+
gap: '16px'
|
|
614
|
+
}}>
|
|
615
|
+
{products.slice(1).map((product) =>
|
|
616
|
+
renderProductCard(product, product._id, '100px', '12px', '32px', '500')
|
|
617
|
+
)}
|
|
618
|
+
</div>
|
|
619
|
+
)}
|
|
620
|
+
</div>
|
|
621
|
+
) : null
|
|
622
|
+
) : (
|
|
623
|
+
<div style={{
|
|
624
|
+
textAlign: 'center',
|
|
625
|
+
color: '#666',
|
|
626
|
+
padding: '40px',
|
|
627
|
+
width: '100%',
|
|
628
|
+
border: '2px dashed #ddd',
|
|
629
|
+
borderRadius: '8px',
|
|
630
|
+
backgroundColor: '#f9f9f9'
|
|
631
|
+
}}>
|
|
632
|
+
<p>No products selected. Use settings to add products.</p>
|
|
633
|
+
</div>
|
|
634
|
+
)}
|
|
635
|
+
</div>
|
|
634
636
|
</div>
|
|
635
|
-
</div>
|
|
636
637
|
</>
|
|
637
638
|
);
|
|
638
639
|
};
|