tee3apps-cms-sdk-react 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +244 -2
- package/dist/index.d.ts +189 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/App.css +37 -0
- package/src/Page.tsx +5 -2
- package/src/PageComponents/Visual-Components/GroupProductComponent.tsx +182 -318
- package/src/PageComponents/Visual-Components/RichTextComponent.tsx +28 -0
- package/src/PageFormComponents/BooleanField.tsx +56 -0
- package/src/PageFormComponents/BoxRenderer.tsx +229 -0
- package/src/PageFormComponents/Button.tsx +127 -0
- package/src/PageFormComponents/DateField.tsx +46 -0
- package/src/PageFormComponents/ImageComponent.tsx +163 -0
- package/src/PageFormComponents/InputField.tsx +62 -0
- package/src/PageFormComponents/NumberField.tsx +56 -0
- package/src/PageFormComponents/PageForm.css +213 -0
- package/src/PageFormComponents/PageForm.tsx +267 -0
- package/src/PageFormComponents/RadioField.tsx +59 -0
- package/src/PageFormComponents/RowComponent.tsx +82 -0
- package/src/PageFormComponents/SelectField.tsx +183 -0
- package/src/PageFormComponents/Styles/BooleanField.css +56 -0
- package/src/PageFormComponents/Styles/DateField.css +44 -0
- package/src/PageFormComponents/Styles/InputField.css +50 -0
- package/src/PageFormComponents/Styles/NumberField.css +57 -0
- package/src/PageFormComponents/Styles/RadioField.css +66 -0
- package/src/PageFormComponents/Styles/SelectField.css +264 -0
- package/src/PageFormComponents/TextComponent.tsx +45 -0
- package/src/index.ts +2 -2
package/package.json
CHANGED
package/src/App.css
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
.main {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.title {
|
|
7
|
+
display: flex;
|
|
8
|
+
font-weight: bold;
|
|
9
|
+
font-size: 1.875rem; /* 3xl = 30px (1.875rem) */
|
|
10
|
+
justify-content: center;
|
|
11
|
+
padding: 2px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.content-wrapper {
|
|
15
|
+
background-color: #f87171; /* Tailwind's red-400 */
|
|
16
|
+
padding: 1rem; /* 16px */
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.content-box {
|
|
20
|
+
background-color: white;
|
|
21
|
+
padding: 0.5rem; /* 8px */
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.image-box {
|
|
25
|
+
|
|
26
|
+
width: 100%;
|
|
27
|
+
/* height: 280px; */
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
justify-content: center;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.fitted-image {
|
|
35
|
+
width: 100%;
|
|
36
|
+
height: 100%;
|
|
37
|
+
}
|
package/src/Page.tsx
CHANGED
|
@@ -17,6 +17,7 @@ import GroupCategoryComponent, { GroupCategoryComponentProps } from './PageCompo
|
|
|
17
17
|
import GroupImageList, { GroupImageListProps } from './PageComponents/Visual-Components/GroupImageList';
|
|
18
18
|
import TabComponent, { TabComponentProps } from './PageComponents/Visual-Components/TabComponent';
|
|
19
19
|
import ErrorBoundary from './ErrorBoundary';
|
|
20
|
+
import RichTextComponent, { RichTextComponentProps } from './PageComponents/Visual-Components/RichTextComponent';
|
|
20
21
|
const Page = ({data}:any) => {
|
|
21
22
|
const [deviceMode, setDeviceMode] = useState<string>('web');
|
|
22
23
|
const [screenSize, setScreenSize] = useState({
|
|
@@ -64,7 +65,7 @@ const Page = ({data}:any) => {
|
|
|
64
65
|
deviceMode={deviceMode}
|
|
65
66
|
autoAdjustForImages={true}
|
|
66
67
|
>
|
|
67
|
-
{box.components.map((component: { name: string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined; props: TextProps | LinkProps | ImageComponentProps | GroupProductComponentProps | VideoComponentProps | GroupBrandComponentProps | LottieComponentProps | CarouselProps | NavigationProps | GroupVideoListProps | GroupCategoryComponentProps | GroupImageListProps | TabComponentProps; }, compIndex: React.Key | null | undefined) => {
|
|
68
|
+
{box.components.map((component: { name: string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined; props: TextProps | LinkProps | ImageComponentProps | GroupProductComponentProps | VideoComponentProps | GroupBrandComponentProps | LottieComponentProps | CarouselProps | NavigationProps | GroupVideoListProps | GroupCategoryComponentProps | GroupImageListProps | TabComponentProps | RichTextComponentProps; }, compIndex: React.Key | null | undefined) => {
|
|
68
69
|
const getCurrentBoxHeight = () => {
|
|
69
70
|
const validModes = ['web', 'mobileweb', 'mobileapp', 'tablet'] as const;
|
|
70
71
|
const safeDeviceMode = validModes.includes(deviceMode as any)
|
|
@@ -102,7 +103,9 @@ const Page = ({data}:any) => {
|
|
|
102
103
|
return <GroupImageList key={compIndex} props={component.props as GroupImageListProps} deviceMode={deviceMode} />;
|
|
103
104
|
case 'TabComponent':
|
|
104
105
|
return <TabComponent key={compIndex} props={component.props as TabComponentProps} deviceMode={deviceMode} />;
|
|
105
|
-
|
|
106
|
+
case 'RichTextComponent':
|
|
107
|
+
return <RichTextComponent key={compIndex} props={component.props as RichTextComponentProps} />;
|
|
108
|
+
default:
|
|
106
109
|
return null;
|
|
107
110
|
}
|
|
108
111
|
} catch (err) {
|
|
@@ -127,6 +127,175 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
|
|
|
127
127
|
};
|
|
128
128
|
|
|
129
129
|
const products = getProducts();
|
|
130
|
+
|
|
131
|
+
// Helper function to render product based on style
|
|
132
|
+
const renderProduct = (product: Product, key: string) => {
|
|
133
|
+
if (currentstyle === 'STYLE1') {
|
|
134
|
+
return (
|
|
135
|
+
<div key={key}>
|
|
136
|
+
<ProductListViewOne props={product} />
|
|
137
|
+
</div>
|
|
138
|
+
);
|
|
139
|
+
} else if (currentstyle === 'STYLE2') {
|
|
140
|
+
return (
|
|
141
|
+
<div key={key}>
|
|
142
|
+
<ProductListViewTwo props={product} />
|
|
143
|
+
</div>
|
|
144
|
+
);
|
|
145
|
+
} else {
|
|
146
|
+
// Default style (NONE) - inline JSX
|
|
147
|
+
return (
|
|
148
|
+
<a href={`/${product.code}`} target={'_blank'} rel="noopener noreferrer" style={{textDecoration:"none"}} key={key}>
|
|
149
|
+
<div
|
|
150
|
+
className="productImageSlide"
|
|
151
|
+
style={{
|
|
152
|
+
height: 'auto',
|
|
153
|
+
minWidth: deviceMode === 'mobileapp' || deviceMode === 'mobileweb' ? '120px' : '150px',
|
|
154
|
+
borderRadius: '8px',
|
|
155
|
+
overflow: 'hidden',
|
|
156
|
+
border: '1px solid #eee',
|
|
157
|
+
backgroundColor: '#fff',
|
|
158
|
+
display: 'flex',
|
|
159
|
+
flexDirection: 'column',
|
|
160
|
+
alignItems: 'center',
|
|
161
|
+
justifyContent: 'center',
|
|
162
|
+
padding: '12px',
|
|
163
|
+
boxShadow: '0 2px 4px rgba(0,0,0,0.1)',
|
|
164
|
+
transition: 'transform 0.2s ease',
|
|
165
|
+
cursor: 'pointer',
|
|
166
|
+
}}
|
|
167
|
+
onMouseOver={(e) => {
|
|
168
|
+
e.currentTarget.style.transform = 'translateY(-2px)';
|
|
169
|
+
e.currentTarget.style.boxShadow = '0 4px 8px rgba(0,0,0,0.15)';
|
|
170
|
+
}}
|
|
171
|
+
onMouseOut={(e) => {
|
|
172
|
+
e.currentTarget.style.transform = 'translateY(0)';
|
|
173
|
+
e.currentTarget.style.boxShadow = '0 2px 4px rgba(0,0,0,0.1)';
|
|
174
|
+
}}
|
|
175
|
+
>
|
|
176
|
+
<div
|
|
177
|
+
style={{
|
|
178
|
+
height: '120px',
|
|
179
|
+
width: '100%',
|
|
180
|
+
display: 'flex',
|
|
181
|
+
alignItems: 'center',
|
|
182
|
+
justifyContent: 'center',
|
|
183
|
+
marginBottom: '8px',
|
|
184
|
+
}}
|
|
185
|
+
>
|
|
186
|
+
<img
|
|
187
|
+
src={`${Linodeurl}${product.image?.url}`}
|
|
188
|
+
alt={typeof product.name === 'object' ? product.name.all : product.name}
|
|
189
|
+
style={{ width: '100%', height: '100%', objectFit: 'contain' }}
|
|
190
|
+
/>
|
|
191
|
+
</div>
|
|
192
|
+
|
|
193
|
+
{showProductName && (
|
|
194
|
+
<div
|
|
195
|
+
style={{
|
|
196
|
+
marginTop: '8px',
|
|
197
|
+
textAlign: 'center',
|
|
198
|
+
fontSize: '14px',
|
|
199
|
+
fontWeight: '500',
|
|
200
|
+
color: '#333',
|
|
201
|
+
lineHeight: '1.4',
|
|
202
|
+
height: '40px',
|
|
203
|
+
overflow: 'hidden',
|
|
204
|
+
display: '-webkit-box',
|
|
205
|
+
WebkitLineClamp: 2,
|
|
206
|
+
WebkitBoxOrient: 'vertical',
|
|
207
|
+
}}
|
|
208
|
+
>
|
|
209
|
+
{typeof product.name === 'object' ? product.name.all : product.name}
|
|
210
|
+
<h1 style={{ fontSize: '16px', fontWeight: '700', color: '#333' }}>
|
|
211
|
+
{product?.price?.SP?.$numberDecimal}
|
|
212
|
+
</h1>
|
|
213
|
+
</div>
|
|
214
|
+
)}
|
|
215
|
+
</div>
|
|
216
|
+
</a>
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
// Helper function to render product card (for grid layouts)
|
|
222
|
+
const renderProductCard = (product: Product, key: string, imageHeight: string = '120px', fontSize: string = '14px', nameHeight: string = '40px', fontWeight: string = '500') => {
|
|
223
|
+
if (currentstyle === 'STYLE1') {
|
|
224
|
+
return (
|
|
225
|
+
<div key={key}>
|
|
226
|
+
<ProductListViewOne props={product} />
|
|
227
|
+
</div>
|
|
228
|
+
);
|
|
229
|
+
} else if (currentstyle === 'STYLE2') {
|
|
230
|
+
return (
|
|
231
|
+
<div key={key}>
|
|
232
|
+
<ProductListViewTwo props={product} />
|
|
233
|
+
</div>
|
|
234
|
+
);
|
|
235
|
+
} else {
|
|
236
|
+
// Default style (NONE) - inline JSX
|
|
237
|
+
return (
|
|
238
|
+
<div
|
|
239
|
+
key={key}
|
|
240
|
+
className="productImageSlide"
|
|
241
|
+
style={{
|
|
242
|
+
height: 'auto',
|
|
243
|
+
borderRadius: '8px',
|
|
244
|
+
overflow: 'hidden',
|
|
245
|
+
border: '1px solid #eee',
|
|
246
|
+
backgroundColor: '#fff',
|
|
247
|
+
display: 'flex',
|
|
248
|
+
flexDirection: 'column',
|
|
249
|
+
alignItems: 'center',
|
|
250
|
+
justifyContent: 'center',
|
|
251
|
+
padding: '12px',
|
|
252
|
+
boxShadow: '0 2px 4px rgba(0,0,0,0.1)',
|
|
253
|
+
transition: 'transform 0.2s ease',
|
|
254
|
+
cursor: 'pointer'
|
|
255
|
+
}}
|
|
256
|
+
onMouseOver={(e) => {
|
|
257
|
+
e.currentTarget.style.transform = 'translateY(-2px)';
|
|
258
|
+
e.currentTarget.style.boxShadow = '0 4px 8px rgba(0,0,0,0.15)';
|
|
259
|
+
}}
|
|
260
|
+
onMouseOut={(e) => {
|
|
261
|
+
e.currentTarget.style.transform = 'translateY(0)';
|
|
262
|
+
e.currentTarget.style.boxShadow = '0 2px 4px rgba(0,0,0,0.1)';
|
|
263
|
+
}}
|
|
264
|
+
>
|
|
265
|
+
<div style={{
|
|
266
|
+
height: imageHeight,
|
|
267
|
+
width: '100%',
|
|
268
|
+
display: 'flex',
|
|
269
|
+
alignItems: 'center',
|
|
270
|
+
justifyContent: 'center',
|
|
271
|
+
marginBottom: '8px'
|
|
272
|
+
}}>
|
|
273
|
+
<img
|
|
274
|
+
src={`${Linodeurl}${product.image?.all?.url || product.image?.url}`}
|
|
275
|
+
alt=""
|
|
276
|
+
style={{ width: '100%', height: '100%', objectFit: 'contain' }}
|
|
277
|
+
/>
|
|
278
|
+
</div>
|
|
279
|
+
{showProductName && <div style={{
|
|
280
|
+
textAlign: 'center',
|
|
281
|
+
fontSize: fontSize,
|
|
282
|
+
fontWeight: fontWeight,
|
|
283
|
+
color: '#333',
|
|
284
|
+
lineHeight: '1.4',
|
|
285
|
+
...(nameHeight === 'auto' ? {} : {
|
|
286
|
+
height: nameHeight,
|
|
287
|
+
overflow: 'hidden',
|
|
288
|
+
display: '-webkit-box',
|
|
289
|
+
WebkitLineClamp: 2,
|
|
290
|
+
WebkitBoxOrient: 'vertical'
|
|
291
|
+
})
|
|
292
|
+
}}>
|
|
293
|
+
{typeof product.name === 'object' ? (product.name as { all: string }).all : product.name}
|
|
294
|
+
</div>}
|
|
295
|
+
</div>
|
|
296
|
+
);
|
|
297
|
+
}
|
|
298
|
+
};
|
|
130
299
|
|
|
131
300
|
// Carousel navigation functions
|
|
132
301
|
const scrollLeft = () => {
|
|
@@ -300,100 +469,9 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
|
|
|
300
469
|
>
|
|
301
470
|
{products.length > 0 ? (
|
|
302
471
|
currentLayout === 'NONE' ? (
|
|
303
|
-
products.slice(0, props.type === 'static' ? 15 : products.length).map((product) =>
|
|
304
|
-
|
|
305
|
-
|
|
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.code}`} 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
|
-
})
|
|
472
|
+
products.slice(0, props.type === 'static' ? 15 : products.length).map((product) =>
|
|
473
|
+
renderProduct(product, product._id)
|
|
474
|
+
)
|
|
397
475
|
) : currentLayout === 'SMALL' ? (
|
|
398
476
|
<div style={{
|
|
399
477
|
display: 'grid',
|
|
@@ -402,64 +480,9 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
|
|
|
402
480
|
padding: '8px'
|
|
403
481
|
}}>
|
|
404
482
|
{
|
|
405
|
-
products.map((product) =>
|
|
406
|
-
|
|
407
|
-
|
|
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
|
-
))}
|
|
483
|
+
products.map((product) =>
|
|
484
|
+
renderProductCard(product, product._id, '100px', '12px', '32px')
|
|
485
|
+
)}
|
|
463
486
|
</div>
|
|
464
487
|
) : currentLayout === 'MEDIUM' ? (
|
|
465
488
|
<div style={{
|
|
@@ -469,118 +492,14 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
|
|
|
469
492
|
padding: '8px'
|
|
470
493
|
}}>
|
|
471
494
|
{
|
|
472
|
-
products.map((product) =>
|
|
473
|
-
|
|
474
|
-
|
|
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
|
-
))}
|
|
495
|
+
products.map((product) =>
|
|
496
|
+
renderProductCard(product, product._id, '120px', '14px', '40px')
|
|
497
|
+
)}
|
|
530
498
|
</div>
|
|
531
499
|
) : currentLayout === 'MEDIUM_THREE' ? (
|
|
532
500
|
<div style={{ display: 'flex', flexDirection: 'column', gap: '16px', padding: '8px' }}>
|
|
533
501
|
{products.length > 0 && (
|
|
534
|
-
|
|
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>
|
|
502
|
+
renderProductCard(products[0], products[0]._id, '160px', '16px', 'auto', '600')
|
|
584
503
|
)}
|
|
585
504
|
{products.length > 1 && (
|
|
586
505
|
<div style={{
|
|
@@ -588,64 +507,9 @@ const GroupProductComponent: React.FC<GroupProductComponentMainProps> = ({
|
|
|
588
507
|
gridTemplateColumns: 'repeat(2,1fr)',
|
|
589
508
|
gap: '16px'
|
|
590
509
|
}}>
|
|
591
|
-
{products.slice(1).map((product) =>
|
|
592
|
-
|
|
593
|
-
|
|
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
|
-
))}
|
|
510
|
+
{products.slice(1).map((product) =>
|
|
511
|
+
renderProductCard(product, product._id, '100px', '12px', '32px', '500')
|
|
512
|
+
)}
|
|
649
513
|
</div>
|
|
650
514
|
)}
|
|
651
515
|
</div>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
export interface RichTextComponentProps {
|
|
4
|
+
content: {
|
|
5
|
+
all: string;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const RichTextComponent: React.FC<{ props: RichTextComponentProps }> = ({ props }) => {
|
|
10
|
+
const htmlContent = props?.content?.all || '';
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<div
|
|
14
|
+
style={{
|
|
15
|
+
width: '100%',
|
|
16
|
+
maxWidth: '100%',
|
|
17
|
+
wordWrap: 'break-word',
|
|
18
|
+
overflowWrap: 'break-word',
|
|
19
|
+
boxSizing: 'border-box',
|
|
20
|
+
padding: '20px',
|
|
21
|
+
}}
|
|
22
|
+
dangerouslySetInnerHTML={{ __html: htmlContent }}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default RichTextComponent;
|
|
28
|
+
|