tee3apps-cms-sdk-react 0.0.1
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/.env +11 -0
- package/README.md +255 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +13 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +33 -0
- package/rollup.config.js +43 -0
- package/src/Components/BoxRenderer.tsx +108 -0
- package/src/Components/ComponentRenderer.tsx +29 -0
- package/src/Components/ImageComponent.tsx +68 -0
- package/src/Components/RowComponent.tsx +66 -0
- package/src/Components/TextComponent.tsx +47 -0
- package/src/ErrorBoundary.tsx +35 -0
- package/src/Page.tsx +124 -0
- package/src/PageComponents/BoxComponent.tsx +397 -0
- package/src/PageComponents/RowComponent.tsx +113 -0
- package/src/PageComponents/Visual-Components/CarouselComponent.tsx +366 -0
- package/src/PageComponents/Visual-Components/GroupBrandComponent.tsx +391 -0
- package/src/PageComponents/Visual-Components/GroupCategoryComponent.tsx +425 -0
- package/src/PageComponents/Visual-Components/GroupImageList.tsx +669 -0
- package/src/PageComponents/Visual-Components/GroupProductComponent.tsx +671 -0
- package/src/PageComponents/Visual-Components/GroupVideoList.tsx +590 -0
- package/src/PageComponents/Visual-Components/ImageComponent.tsx +163 -0
- package/src/PageComponents/Visual-Components/LinkComponent.tsx +68 -0
- package/src/PageComponents/Visual-Components/LottieComponent.tsx +213 -0
- package/src/PageComponents/Visual-Components/NavigationComponent.tsx +178 -0
- package/src/PageComponents/Visual-Components/Styles/ProductListViewOne.tsx +102 -0
- package/src/PageComponents/Visual-Components/Styles/ProductListViewTwo.tsx +104 -0
- package/src/PageComponents/Visual-Components/Styles/product-list-view-one.css +166 -0
- package/src/PageComponents/Visual-Components/Styles/product-list-view-two.css +182 -0
- package/src/PageComponents/Visual-Components/TabComponent.tsx +1169 -0
- package/src/PageComponents/Visual-Components/TextComponent.tsx +114 -0
- package/src/PageComponents/Visual-Components/VideoComponent.tsx +191 -0
- package/src/PageComponents/Visual-Components/tab.css +697 -0
- package/src/common.interface.ts +216 -0
- package/src/const.ts +6 -0
- package/src/env.d.ts +15 -0
- package/src/index.css +82 -0
- package/src/index.ts +2 -0
- package/src/types.ts +234 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,671 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ProductListViewOne from '../Visual-Components/Styles/ProductListViewOne';
|
|
3
|
+
import ProductListViewTwo from '../Visual-Components/Styles/ProductListViewTwo';
|
|
4
|
+
import { Linodeurl } from '../../const';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
interface Product {
|
|
8
|
+
_id: string;
|
|
9
|
+
code: string;
|
|
10
|
+
name: string | { all: string };
|
|
11
|
+
image: any;
|
|
12
|
+
isActive: boolean;
|
|
13
|
+
price?:any;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface GroupProductStatic {
|
|
17
|
+
_id: string;
|
|
18
|
+
code: string;
|
|
19
|
+
name: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface GroupProductDynamic {
|
|
23
|
+
code: string;
|
|
24
|
+
name: { all: string };
|
|
25
|
+
list: Product[];
|
|
26
|
+
isActive: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface GroupProductData {
|
|
30
|
+
static: GroupProductStatic;
|
|
31
|
+
dynamic: GroupProductDynamic;
|
|
32
|
+
showItems:Product[]
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface HeaderTextStyle {
|
|
37
|
+
fontSize: number;
|
|
38
|
+
fontColor: string;
|
|
39
|
+
isBold: boolean;
|
|
40
|
+
isItalic: boolean;
|
|
41
|
+
isUnderline: boolean;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
interface DeviceBooleanProps {
|
|
45
|
+
web: boolean;
|
|
46
|
+
mobileweb: boolean;
|
|
47
|
+
mobileapp: boolean;
|
|
48
|
+
tablet: boolean;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface DeviceLayoutProps {
|
|
52
|
+
web: string;
|
|
53
|
+
mobileweb: string;
|
|
54
|
+
mobileapp: string;
|
|
55
|
+
tablet: string;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface GroupProductComponentProps {
|
|
59
|
+
headerText: { all: string };
|
|
60
|
+
type: string;
|
|
61
|
+
groupproduct: GroupProductData;
|
|
62
|
+
showItems:Product[]
|
|
63
|
+
activeStatus: boolean;
|
|
64
|
+
headerImage: string;
|
|
65
|
+
selectedProducts: Product[];
|
|
66
|
+
items: any[];
|
|
67
|
+
|
|
68
|
+
cardColor: string;
|
|
69
|
+
showProductName: DeviceBooleanProps;
|
|
70
|
+
headerTextStyle: HeaderTextStyle;
|
|
71
|
+
layout: DeviceLayoutProps;
|
|
72
|
+
style: DeviceLayoutProps;
|
|
73
|
+
|
|
74
|
+
showHeader: DeviceBooleanProps;
|
|
75
|
+
isHorizontalScroll: DeviceBooleanProps;
|
|
76
|
+
headerBackground: string;
|
|
77
|
+
viewAllLink?: string;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
interface GroupProductComponentMainProps {
|
|
81
|
+
props: GroupProductComponentProps;
|
|
82
|
+
deviceMode?: string;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
|
|
86
|
+
props,
|
|
87
|
+
deviceMode = 'web'
|
|
88
|
+
}) => {
|
|
89
|
+
const getCurrentBooleanProp = (prop: DeviceBooleanProps) => {
|
|
90
|
+
switch(deviceMode) {
|
|
91
|
+
case 'mobileweb': return prop.mobileweb;
|
|
92
|
+
case 'mobileapp': return prop.mobileapp;
|
|
93
|
+
case 'tablet': return prop.tablet;
|
|
94
|
+
case 'web':
|
|
95
|
+
default: return prop.web;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const getCurrentLayout = () => {
|
|
100
|
+
switch(deviceMode) {
|
|
101
|
+
case 'mobileweb': return props.layout.mobileweb;
|
|
102
|
+
case 'mobileapp': return props.layout.mobileapp;
|
|
103
|
+
case 'tablet': return props.layout.tablet;
|
|
104
|
+
case 'web':
|
|
105
|
+
default: return props.layout.web;
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const getCurrentStyle = () => {
|
|
110
|
+
switch(deviceMode) {
|
|
111
|
+
case 'mobileweb': return props.style.mobileweb;
|
|
112
|
+
case 'mobileapp': return props.style.mobileapp;
|
|
113
|
+
case 'tablet': return props.style.tablet;
|
|
114
|
+
case 'web':
|
|
115
|
+
default: return props.style.web;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
const showHeader = getCurrentBooleanProp(props.showHeader);
|
|
119
|
+
const showProductName = getCurrentBooleanProp(props.showProductName);
|
|
120
|
+
const isHorizontalScroll = getCurrentBooleanProp(props.isHorizontalScroll);
|
|
121
|
+
const currentLayout = getCurrentLayout();
|
|
122
|
+
const currentstyle=getCurrentStyle();
|
|
123
|
+
|
|
124
|
+
const getProducts = () => {
|
|
125
|
+
if(props?.groupproduct?.showItems) return props.groupproduct.showItems
|
|
126
|
+
return [];
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const products = getProducts();
|
|
130
|
+
|
|
131
|
+
// Carousel navigation functions
|
|
132
|
+
const scrollLeft = () => {
|
|
133
|
+
const carousel = document.querySelector('.groupProductCarousel');
|
|
134
|
+
if (carousel) {
|
|
135
|
+
carousel.scrollBy({ left: -200, behavior: 'smooth' });
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
const scrollRight = () => {
|
|
140
|
+
const carousel = document.querySelector('.groupProductCarousel');
|
|
141
|
+
if (carousel) {
|
|
142
|
+
carousel.scrollBy({ left: 200, behavior: 'smooth' });
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
return (
|
|
147
|
+
<div
|
|
148
|
+
style={{
|
|
149
|
+
border: '1px solid #e1e1e1',
|
|
150
|
+
width: '100%',
|
|
151
|
+
maxWidth: '100%',
|
|
152
|
+
borderRadius: '0px',
|
|
153
|
+
minHeight: '100px',
|
|
154
|
+
position: 'relative',
|
|
155
|
+
overflow: 'hidden',
|
|
156
|
+
marginBottom:'20px',
|
|
157
|
+
marginTop:'0px'
|
|
158
|
+
|
|
159
|
+
}}
|
|
160
|
+
className='GroupProductComponent'
|
|
161
|
+
>
|
|
162
|
+
{showHeader && (
|
|
163
|
+
<div
|
|
164
|
+
className="groupProductHeader"
|
|
165
|
+
style={{
|
|
166
|
+
backgroundColor: props.headerBackground,
|
|
167
|
+
padding: '12px 16px',
|
|
168
|
+
borderRadius: '0px',
|
|
169
|
+
marginBottom: '4px',
|
|
170
|
+
display: 'flex',
|
|
171
|
+
alignItems: 'center',
|
|
172
|
+
justifyContent: 'space-between',
|
|
173
|
+
flexWrap: 'wrap',
|
|
174
|
+
gap: '12px',
|
|
175
|
+
}}
|
|
176
|
+
>
|
|
177
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>
|
|
178
|
+
{props.headerImage && (
|
|
179
|
+
<div style={{ width: '32px', height: '32px' }}>
|
|
180
|
+
{/* <ImageDisplayComponent
|
|
181
|
+
fileUrl={props.headerImage}
|
|
182
|
+
preserveAspectRatio={true}
|
|
183
|
+
maxWidth="100%"
|
|
184
|
+
maxHeight="32px"
|
|
185
|
+
/> */}
|
|
186
|
+
<img
|
|
187
|
+
src={`${Linodeurl}${props.headerImage}`}
|
|
188
|
+
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
|
|
189
|
+
/>
|
|
190
|
+
</div>
|
|
191
|
+
)}
|
|
192
|
+
<p style={{
|
|
193
|
+
color: props.headerTextStyle.fontColor,
|
|
194
|
+
fontSize: `${props.headerTextStyle.fontSize}px`,
|
|
195
|
+
fontWeight: props.headerTextStyle.isBold ? 'bold' : 'normal',
|
|
196
|
+
fontStyle: props.headerTextStyle.isItalic ? 'italic' : 'normal',
|
|
197
|
+
textDecoration: props.headerTextStyle.isUnderline ? 'underline' : 'none',
|
|
198
|
+
margin: 0
|
|
199
|
+
}}>
|
|
200
|
+
{props.headerText?.all || 'Header text'}
|
|
201
|
+
</p>
|
|
202
|
+
</div>
|
|
203
|
+
|
|
204
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '16px' }}>
|
|
205
|
+
|
|
206
|
+
{props.type=='static' && (
|
|
207
|
+
<a
|
|
208
|
+
href={`http://localhost:5173/${props.groupproduct.static.code}/s?type=groupproduct`}
|
|
209
|
+
target="_blank"
|
|
210
|
+
rel="noopener noreferrer"
|
|
211
|
+
style={{
|
|
212
|
+
color: 'black',
|
|
213
|
+
textDecoration: 'none',
|
|
214
|
+
fontWeight: '500',
|
|
215
|
+
fontSize: '14px',
|
|
216
|
+
padding: '6px 12px',
|
|
217
|
+
border: 'none',
|
|
218
|
+
borderRadius: '4px',
|
|
219
|
+
backgroundColor: 'transparent',
|
|
220
|
+
cursor: 'pointer'
|
|
221
|
+
}}
|
|
222
|
+
>
|
|
223
|
+
View All
|
|
224
|
+
</a>
|
|
225
|
+
)}
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
{currentLayout === 'NONE' && products.length > 4 && (
|
|
231
|
+
<div style={{ display: 'flex', gap: '8px' }}>
|
|
232
|
+
<button
|
|
233
|
+
onClick={scrollLeft}
|
|
234
|
+
style={{
|
|
235
|
+
width: '32px',
|
|
236
|
+
height: '32px',
|
|
237
|
+
borderRadius: '50%',
|
|
238
|
+
border: '1px solid #ddd',
|
|
239
|
+
backgroundColor: '#fff',
|
|
240
|
+
cursor: 'pointer',
|
|
241
|
+
display: 'flex',
|
|
242
|
+
alignItems: 'center',
|
|
243
|
+
justifyContent: 'center',
|
|
244
|
+
fontSize: '16px',
|
|
245
|
+
fontWeight: 'bold'
|
|
246
|
+
}}
|
|
247
|
+
onMouseOver={(e) => {
|
|
248
|
+
e.currentTarget.style.backgroundColor = '#f8f9fa';
|
|
249
|
+
}}
|
|
250
|
+
onMouseOut={(e) => {
|
|
251
|
+
e.currentTarget.style.backgroundColor = '#fff';
|
|
252
|
+
}}
|
|
253
|
+
>
|
|
254
|
+
‹
|
|
255
|
+
</button>
|
|
256
|
+
<button
|
|
257
|
+
onClick={scrollRight}
|
|
258
|
+
style={{
|
|
259
|
+
width: '32px',
|
|
260
|
+
height: '32px',
|
|
261
|
+
borderRadius: '50%',
|
|
262
|
+
border: '1px solid #ddd',
|
|
263
|
+
backgroundColor: '#fff',
|
|
264
|
+
cursor: 'pointer',
|
|
265
|
+
display: 'flex',
|
|
266
|
+
alignItems: 'center',
|
|
267
|
+
justifyContent: 'center',
|
|
268
|
+
fontSize: '16px',
|
|
269
|
+
fontWeight: 'bold'
|
|
270
|
+
}}
|
|
271
|
+
onMouseOver={(e) => {
|
|
272
|
+
e.currentTarget.style.backgroundColor = '#f8f9fa';
|
|
273
|
+
}}
|
|
274
|
+
onMouseOut={(e) => {
|
|
275
|
+
e.currentTarget.style.backgroundColor = '#fff';
|
|
276
|
+
}}
|
|
277
|
+
>
|
|
278
|
+
›
|
|
279
|
+
</button>
|
|
280
|
+
</div>
|
|
281
|
+
)}
|
|
282
|
+
</div>
|
|
283
|
+
</div>
|
|
284
|
+
)}
|
|
285
|
+
|
|
286
|
+
<div
|
|
287
|
+
className="groupProductCarousel"
|
|
288
|
+
style={{
|
|
289
|
+
display: currentLayout === 'NONE' ? 'flex' : 'block',
|
|
290
|
+
overflowX: currentLayout === 'NONE' && isHorizontalScroll ? 'auto' : 'visible',
|
|
291
|
+
gap: currentLayout === 'NONE' ? '12px' : '0',
|
|
292
|
+
padding: '12px',
|
|
293
|
+
scrollBehavior: 'smooth',
|
|
294
|
+
backgroundColor: props.cardColor || '#fff',
|
|
295
|
+
scrollbarWidth: 'thin',
|
|
296
|
+
borderRadius: '8px',
|
|
297
|
+
position: 'relative',
|
|
298
|
+
scrollbarColor: '#c1c1c1 transparent'
|
|
299
|
+
}}
|
|
300
|
+
>
|
|
301
|
+
{products.length > 0 ? (
|
|
302
|
+
currentLayout === 'NONE' ? (
|
|
303
|
+
products.slice(0, props.type === 'static' ? 15 : products.length).map((product) => {
|
|
304
|
+
if (currentstyle === 'STYLE1') {
|
|
305
|
+
return (
|
|
306
|
+
<div key={product._id}>
|
|
307
|
+
<ProductListViewOne props={product} />
|
|
308
|
+
</div>
|
|
309
|
+
);
|
|
310
|
+
} else if (currentstyle === 'STYLE2') {
|
|
311
|
+
return (
|
|
312
|
+
<div key={product._id}>
|
|
313
|
+
<ProductListViewTwo props={product} />
|
|
314
|
+
</div>
|
|
315
|
+
);
|
|
316
|
+
} else {
|
|
317
|
+
// Default style (NONE)
|
|
318
|
+
return (
|
|
319
|
+
<a href={`/${product._id}`} target={'_blank'} rel="noopener noreferrer" style={{textDecoration:"none"}}>
|
|
320
|
+
<div
|
|
321
|
+
key={product._id}
|
|
322
|
+
className="productImageSlide"
|
|
323
|
+
style={{
|
|
324
|
+
height: 'auto',
|
|
325
|
+
minWidth: deviceMode === 'mobileapp' || deviceMode === 'mobileweb' ? '120px' : '150px',
|
|
326
|
+
|
|
327
|
+
borderRadius: '8px',
|
|
328
|
+
overflow: 'hidden',
|
|
329
|
+
border: '1px solid #eee',
|
|
330
|
+
backgroundColor: '#fff',
|
|
331
|
+
display: 'flex',
|
|
332
|
+
flexDirection: 'column',
|
|
333
|
+
alignItems: 'center',
|
|
334
|
+
justifyContent: 'center',
|
|
335
|
+
padding: '12px',
|
|
336
|
+
boxShadow: '0 2px 4px rgba(0,0,0,0.1)',
|
|
337
|
+
transition: 'transform 0.2s ease',
|
|
338
|
+
cursor: 'pointer',
|
|
339
|
+
}}
|
|
340
|
+
onMouseOver={(e) => {
|
|
341
|
+
e.currentTarget.style.transform = 'translateY(-2px)';
|
|
342
|
+
e.currentTarget.style.boxShadow = '0 4px 8px rgba(0,0,0,0.15)';
|
|
343
|
+
}}
|
|
344
|
+
onMouseOut={(e) => {
|
|
345
|
+
e.currentTarget.style.transform = 'translateY(0)';
|
|
346
|
+
e.currentTarget.style.boxShadow = '0 2px 4px rgba(0,0,0,0.1)';
|
|
347
|
+
}}
|
|
348
|
+
>
|
|
349
|
+
<div
|
|
350
|
+
style={{
|
|
351
|
+
height: '120px',
|
|
352
|
+
width: '100%',
|
|
353
|
+
display: 'flex',
|
|
354
|
+
alignItems: 'center',
|
|
355
|
+
justifyContent: 'center',
|
|
356
|
+
marginBottom: '8px',
|
|
357
|
+
}}
|
|
358
|
+
>
|
|
359
|
+
<img
|
|
360
|
+
src={`${Linodeurl}${product.image?.url}`}
|
|
361
|
+
alt={typeof product.name === 'object' ? product.name.all : product.name}
|
|
362
|
+
style={{ width: '100%', height: '100%', objectFit: 'contain' }}
|
|
363
|
+
/>
|
|
364
|
+
</div>
|
|
365
|
+
|
|
366
|
+
{showProductName && (
|
|
367
|
+
<div
|
|
368
|
+
style={{
|
|
369
|
+
marginTop: '8px',
|
|
370
|
+
textAlign: 'center',
|
|
371
|
+
fontSize: '14px',
|
|
372
|
+
fontWeight: '500',
|
|
373
|
+
color: '#333',
|
|
374
|
+
lineHeight: '1.4',
|
|
375
|
+
height: '40px',
|
|
376
|
+
overflow: 'hidden',
|
|
377
|
+
display: '-webkit-box',
|
|
378
|
+
WebkitLineClamp: 2,
|
|
379
|
+
WebkitBoxOrient: 'vertical',
|
|
380
|
+
}}
|
|
381
|
+
>
|
|
382
|
+
{typeof product.name === 'object' ? product.name.all : product.name}
|
|
383
|
+
<h1 style={{ fontSize: '16px', fontWeight: '700', color: '#333' }}>
|
|
384
|
+
{product?.price?.SP?.$numberDecimal}
|
|
385
|
+
</h1>
|
|
386
|
+
{/* <h2 style={{ fontSize: '14px', fontWeight: '500', color: '#666' }}>
|
|
387
|
+
MRP: {product?.price?.MRP?.$numberDecimal}
|
|
388
|
+
</h2> */}
|
|
389
|
+
</div>
|
|
390
|
+
)}
|
|
391
|
+
</div>
|
|
392
|
+
</a>
|
|
393
|
+
|
|
394
|
+
);
|
|
395
|
+
}
|
|
396
|
+
})
|
|
397
|
+
) : currentLayout === 'SMALL' ? (
|
|
398
|
+
<div style={{
|
|
399
|
+
display: 'grid',
|
|
400
|
+
gridTemplateColumns: 'repeat(2, 1fr)',
|
|
401
|
+
gap: '16px',
|
|
402
|
+
padding: '8px'
|
|
403
|
+
}}>
|
|
404
|
+
{
|
|
405
|
+
products.map((product) => (
|
|
406
|
+
<div
|
|
407
|
+
key={product._id}
|
|
408
|
+
className="productImageSlide"
|
|
409
|
+
style={{
|
|
410
|
+
height: 'auto',
|
|
411
|
+
borderRadius: '8px',
|
|
412
|
+
overflow: 'hidden',
|
|
413
|
+
border: '1px solid #eee',
|
|
414
|
+
backgroundColor: '#fff',
|
|
415
|
+
display: 'flex',
|
|
416
|
+
flexDirection: 'column',
|
|
417
|
+
alignItems: 'center',
|
|
418
|
+
justifyContent: 'center',
|
|
419
|
+
padding: '12px',
|
|
420
|
+
boxShadow: '0 2px 4px rgba(0,0,0,0.1)',
|
|
421
|
+
transition: 'transform 0.2s ease',
|
|
422
|
+
cursor: 'pointer'
|
|
423
|
+
}}
|
|
424
|
+
onMouseOver={(e) => {
|
|
425
|
+
e.currentTarget.style.transform = 'translateY(-2px)';
|
|
426
|
+
e.currentTarget.style.boxShadow = '0 4px 8px rgba(0,0,0,0.15)';
|
|
427
|
+
}}
|
|
428
|
+
onMouseOut={(e) => {
|
|
429
|
+
e.currentTarget.style.transform = 'translateY(0)';
|
|
430
|
+
e.currentTarget.style.boxShadow = '0 2px 4px rgba(0,0,0,0.1)';
|
|
431
|
+
}}
|
|
432
|
+
>
|
|
433
|
+
<div style={{
|
|
434
|
+
height: '100px',
|
|
435
|
+
width: '100%',
|
|
436
|
+
display: 'flex',
|
|
437
|
+
alignItems: 'center',
|
|
438
|
+
justifyContent: 'center',
|
|
439
|
+
marginBottom: '8px'
|
|
440
|
+
}}>
|
|
441
|
+
<img
|
|
442
|
+
src={`${Linodeurl}${product.image?.all?.url}`}
|
|
443
|
+
alt=""
|
|
444
|
+
style={{ width: '100%', height: '100%', objectFit: 'contain' }}
|
|
445
|
+
/>
|
|
446
|
+
</div>
|
|
447
|
+
{showProductName && <div style={{
|
|
448
|
+
textAlign: 'center',
|
|
449
|
+
fontSize: '12px',
|
|
450
|
+
fontWeight: '500',
|
|
451
|
+
color: '#333',
|
|
452
|
+
lineHeight: '1.4',
|
|
453
|
+
height: '32px',
|
|
454
|
+
overflow: 'hidden',
|
|
455
|
+
display: '-webkit-box',
|
|
456
|
+
WebkitLineClamp: 2,
|
|
457
|
+
WebkitBoxOrient: 'vertical'
|
|
458
|
+
}}>
|
|
459
|
+
{typeof product.name === 'object' ? (product.name as { all: string }).all : product.name}
|
|
460
|
+
</div>}
|
|
461
|
+
</div>
|
|
462
|
+
))}
|
|
463
|
+
</div>
|
|
464
|
+
) : currentLayout === 'MEDIUM' ? (
|
|
465
|
+
<div style={{
|
|
466
|
+
display: 'grid',
|
|
467
|
+
gridTemplateColumns: 'repeat(3, 1fr)',
|
|
468
|
+
gap: '16px',
|
|
469
|
+
padding: '8px'
|
|
470
|
+
}}>
|
|
471
|
+
{
|
|
472
|
+
products.map((product) => (
|
|
473
|
+
<div
|
|
474
|
+
key={product._id}
|
|
475
|
+
className="productImageSlide"
|
|
476
|
+
style={{
|
|
477
|
+
height: 'auto',
|
|
478
|
+
borderRadius: '8px',
|
|
479
|
+
overflow: 'hidden',
|
|
480
|
+
border: '1px solid #eee',
|
|
481
|
+
backgroundColor: '#fff',
|
|
482
|
+
display: 'flex',
|
|
483
|
+
flexDirection: 'column',
|
|
484
|
+
alignItems: 'center',
|
|
485
|
+
justifyContent: 'center',
|
|
486
|
+
padding: '12px',
|
|
487
|
+
boxShadow: '0 2px 4px rgba(0,0,0,0.1)',
|
|
488
|
+
transition: 'transform 0.2s ease',
|
|
489
|
+
cursor: 'pointer'
|
|
490
|
+
}}
|
|
491
|
+
onMouseOver={(e) => {
|
|
492
|
+
e.currentTarget.style.transform = 'translateY(-2px)';
|
|
493
|
+
e.currentTarget.style.boxShadow = '0 4px 8px rgba(0,0,0,0.15)';
|
|
494
|
+
}}
|
|
495
|
+
onMouseOut={(e) => {
|
|
496
|
+
e.currentTarget.style.transform = 'translateY(0)';
|
|
497
|
+
e.currentTarget.style.boxShadow = '0 2px 4px rgba(0,0,0,0.1)';
|
|
498
|
+
}}
|
|
499
|
+
>
|
|
500
|
+
<div style={{
|
|
501
|
+
height: '120px',
|
|
502
|
+
width: '100%',
|
|
503
|
+
display: 'flex',
|
|
504
|
+
alignItems: 'center',
|
|
505
|
+
justifyContent: 'center',
|
|
506
|
+
marginBottom: '8px'
|
|
507
|
+
}}>
|
|
508
|
+
<img
|
|
509
|
+
src={`${Linodeurl}${product.image?.all?.url}`}
|
|
510
|
+
alt=""
|
|
511
|
+
style={{ width: '100%', height: '100%', objectFit: 'contain' }}
|
|
512
|
+
/>
|
|
513
|
+
</div>
|
|
514
|
+
{showProductName && <div style={{
|
|
515
|
+
textAlign: 'center',
|
|
516
|
+
fontSize: '14px',
|
|
517
|
+
fontWeight: '500',
|
|
518
|
+
color: '#333',
|
|
519
|
+
lineHeight: '1.4',
|
|
520
|
+
height: '40px',
|
|
521
|
+
overflow: 'hidden',
|
|
522
|
+
display: '-webkit-box',
|
|
523
|
+
WebkitLineClamp: 2,
|
|
524
|
+
WebkitBoxOrient: 'vertical'
|
|
525
|
+
}}>
|
|
526
|
+
{typeof product.name === 'object' ? (product.name as { all: string }).all : product.name}
|
|
527
|
+
</div>}
|
|
528
|
+
</div>
|
|
529
|
+
))}
|
|
530
|
+
</div>
|
|
531
|
+
) : currentLayout === 'MEDIUM_THREE' ? (
|
|
532
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '16px', padding: '8px' }}>
|
|
533
|
+
{products.length > 0 && (
|
|
534
|
+
<div
|
|
535
|
+
className="productImageSlide"
|
|
536
|
+
style={{
|
|
537
|
+
height: 'auto',
|
|
538
|
+
borderRadius: '8px',
|
|
539
|
+
overflow: 'hidden',
|
|
540
|
+
border: '1px solid #eee',
|
|
541
|
+
backgroundColor: '#fff',
|
|
542
|
+
display: 'flex',
|
|
543
|
+
flexDirection: 'column',
|
|
544
|
+
alignItems: 'center',
|
|
545
|
+
justifyContent: 'center',
|
|
546
|
+
padding: '16px',
|
|
547
|
+
boxShadow: '0 2px 4px rgba(0,0,0,0.1)',
|
|
548
|
+
transition: 'transform 0.2s ease',
|
|
549
|
+
cursor: 'pointer'
|
|
550
|
+
}}
|
|
551
|
+
onMouseOver={(e) => {
|
|
552
|
+
e.currentTarget.style.transform = 'translateY(-2px)';
|
|
553
|
+
e.currentTarget.style.boxShadow = '0 4px 8px rgba(0,0,0,0.15)';
|
|
554
|
+
}}
|
|
555
|
+
onMouseOut={(e) => {
|
|
556
|
+
e.currentTarget.style.transform = 'translateY(0)';
|
|
557
|
+
e.currentTarget.style.boxShadow = '0 2px 4px rgba(0,0,0,0.1)';
|
|
558
|
+
}}
|
|
559
|
+
>
|
|
560
|
+
<div style={{
|
|
561
|
+
height: '160px',
|
|
562
|
+
width: '100%',
|
|
563
|
+
display: 'flex',
|
|
564
|
+
alignItems: 'center',
|
|
565
|
+
justifyContent: 'center',
|
|
566
|
+
marginBottom: '12px'
|
|
567
|
+
}}>
|
|
568
|
+
<img
|
|
569
|
+
src={`${Linodeurl}${products[0].image?.all?.url}`}
|
|
570
|
+
alt=""
|
|
571
|
+
style={{ width: '100%', height: '100%', objectFit: 'contain' }}
|
|
572
|
+
/>
|
|
573
|
+
</div>
|
|
574
|
+
{showProductName && <div style={{
|
|
575
|
+
textAlign: 'center',
|
|
576
|
+
fontSize: '16px',
|
|
577
|
+
fontWeight: '600',
|
|
578
|
+
color: '#333',
|
|
579
|
+
lineHeight: '1.4'
|
|
580
|
+
}}>
|
|
581
|
+
{typeof products[0].name === 'object' ? (products[0].name as { all: string }).all : products[0].name}
|
|
582
|
+
</div>}
|
|
583
|
+
</div>
|
|
584
|
+
)}
|
|
585
|
+
{products.length > 1 && (
|
|
586
|
+
<div style={{
|
|
587
|
+
display: 'grid',
|
|
588
|
+
gridTemplateColumns: 'repeat(2,1fr)',
|
|
589
|
+
gap: '16px'
|
|
590
|
+
}}>
|
|
591
|
+
{products.slice(1).map((product) => (
|
|
592
|
+
<div
|
|
593
|
+
key={product._id}
|
|
594
|
+
className="productImageSlide"
|
|
595
|
+
style={{
|
|
596
|
+
height: 'auto',
|
|
597
|
+
borderRadius: '8px',
|
|
598
|
+
overflow: 'hidden',
|
|
599
|
+
border: '1px solid #eee',
|
|
600
|
+
backgroundColor: '#fff',
|
|
601
|
+
display: 'flex',
|
|
602
|
+
flexDirection: 'column',
|
|
603
|
+
alignItems: 'center',
|
|
604
|
+
justifyContent: 'center',
|
|
605
|
+
padding: '12px',
|
|
606
|
+
boxShadow: '0 2px 4px rgba(0,0,0,0.1)',
|
|
607
|
+
transition: 'transform 0.2s ease',
|
|
608
|
+
cursor: 'pointer'
|
|
609
|
+
}}
|
|
610
|
+
onMouseOver={(e) => {
|
|
611
|
+
e.currentTarget.style.transform = 'translateY(-2px)';
|
|
612
|
+
e.currentTarget.style.boxShadow = '0 4px 8px rgba(0,0,0,0.15)';
|
|
613
|
+
}}
|
|
614
|
+
onMouseOut={(e) => {
|
|
615
|
+
e.currentTarget.style.transform = 'translateY(0)';
|
|
616
|
+
e.currentTarget.style.boxShadow = '0 2px 4px rgba(0,0,0,0.1)';
|
|
617
|
+
}}
|
|
618
|
+
>
|
|
619
|
+
<div style={{
|
|
620
|
+
height: '100px',
|
|
621
|
+
width: '100%',
|
|
622
|
+
display: 'flex',
|
|
623
|
+
alignItems: 'center',
|
|
624
|
+
justifyContent: 'center',
|
|
625
|
+
marginBottom: '8px'
|
|
626
|
+
}}>
|
|
627
|
+
<img
|
|
628
|
+
src={`${Linodeurl}${product.image?.all?.url}`}
|
|
629
|
+
alt=""
|
|
630
|
+
style={{ width: '100%', height: '100%', objectFit: 'contain' }}
|
|
631
|
+
/>
|
|
632
|
+
</div>
|
|
633
|
+
{showProductName && <div style={{
|
|
634
|
+
textAlign: 'center',
|
|
635
|
+
fontSize: '12px',
|
|
636
|
+
fontWeight: '500',
|
|
637
|
+
color: '#333',
|
|
638
|
+
lineHeight: '1.4',
|
|
639
|
+
height: '32px',
|
|
640
|
+
overflow: 'hidden',
|
|
641
|
+
display: '-webkit-box',
|
|
642
|
+
WebkitLineClamp: 2,
|
|
643
|
+
WebkitBoxOrient: 'vertical'
|
|
644
|
+
}}>
|
|
645
|
+
{typeof product.name === 'object' ? (product.name as { all: string }).all : product.name}
|
|
646
|
+
</div>}
|
|
647
|
+
</div>
|
|
648
|
+
))}
|
|
649
|
+
</div>
|
|
650
|
+
)}
|
|
651
|
+
</div>
|
|
652
|
+
) : null
|
|
653
|
+
) : (
|
|
654
|
+
<div style={{
|
|
655
|
+
textAlign: 'center',
|
|
656
|
+
color: '#666',
|
|
657
|
+
padding: '40px',
|
|
658
|
+
width: '100%',
|
|
659
|
+
border: '2px dashed #ddd',
|
|
660
|
+
borderRadius: '8px',
|
|
661
|
+
backgroundColor: '#f9f9f9'
|
|
662
|
+
}}>
|
|
663
|
+
<p>No products selected. Use settings to add products.</p>
|
|
664
|
+
</div>
|
|
665
|
+
)}
|
|
666
|
+
</div>
|
|
667
|
+
</div>
|
|
668
|
+
);
|
|
669
|
+
};
|
|
670
|
+
|
|
671
|
+
export default GroupProductComponent;
|