tee3apps-cms-sdk-react 0.0.33 → 0.0.35

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.
@@ -8,27 +8,27 @@ interface PageImage {
8
8
  url: string;
9
9
  width: number;
10
10
  height: number;
11
- }
12
-
13
- interface PageId {
11
+ }
12
+
13
+ interface PageId {
14
14
  _id: string;
15
15
  name: string;
16
16
  code: string;
17
17
  image: PageImage;
18
18
  isActive: boolean;
19
- }
20
-
21
- interface Channel {
19
+ }
20
+
21
+ interface Channel {
22
22
  _id: string;
23
23
  name: string;
24
24
  code: string;
25
25
  isActive: boolean;
26
- }
27
-
28
- interface PageDataItem {
26
+ }
27
+
28
+ interface PageDataItem {
29
29
  page_id: any;
30
30
  channel: Channel;
31
- }
31
+ }
32
32
  interface BrandImage {
33
33
  shapeImageId: string;
34
34
  shape: string;
@@ -64,7 +64,7 @@ interface GroupBrandDynamic {
64
64
  interface GroupBrandData {
65
65
  static: GroupBrandStatic;
66
66
  dynamic: GroupBrandDynamic;
67
- showItems:BrandItem[];
67
+ showItems: BrandItem[];
68
68
  }
69
69
 
70
70
  interface HeaderTextStyle {
@@ -93,7 +93,7 @@ export interface GroupBrandComponentProps {
93
93
  headerText: any;
94
94
  type: string;
95
95
  groupbrand: GroupBrandData;
96
- showItems?:BrandItem[];
96
+ showItems?: BrandItem[];
97
97
  selectedBrands?: BrandItem[];
98
98
  items?: BrandItem[];
99
99
  cardColor: string;
@@ -127,15 +127,15 @@ const GroupBrandComponent: React.FC<GroupBrandComponentMainProps> = ({ props, de
127
127
  // Safely fall back to web, then to 'NONE' if the specific layout is missing
128
128
  if (!props.layout) return 'NONE';
129
129
  switch (deviceMode) {
130
- case 'mobileweb': return props.layout.mobileweb || 'NONE';
131
- case 'mobileapp': return props.layout.mobileapp || 'NONE';
132
- case 'tablet': return props.layout.tablet || 'NONE';
130
+ case 'mobileweb': return props.layout.mobileweb || 'NONE';
131
+ case 'mobileapp': return props.layout.mobileapp || 'NONE';
132
+ case 'tablet': return props.layout.tablet || 'NONE';
133
133
  case 'web':
134
134
  default: return props.layout.web || 'NONE';
135
135
  }
136
136
  };
137
137
 
138
-
138
+
139
139
 
140
140
  const showHeader = getCurrentBooleanProp(props.showHeader);
141
141
  const showBrandName = getCurrentBooleanProp(props.showProductName);
@@ -184,25 +184,25 @@ const GroupBrandComponent: React.FC<GroupBrandComponentMainProps> = ({ props, de
184
184
 
185
185
  const buildBrandHref = (item: BrandItem): string | null => {
186
186
  console.log(item);
187
-
187
+
188
188
  // Check if item has pages and at least one page exists
189
189
  if (item.pages && item.pages.length > 0) {
190
190
  const firstPage = item.pages[0];
191
-
191
+
192
192
  // Check if the page is active
193
- console.log(firstPage.page_id?._id);
194
- // If page is active, use the brand page format
195
- return `/page/${encodeURIComponent(firstPage.page_id)}`;
196
-
193
+ console.log(firstPage.page_id?._id);
194
+ // If page is active, use the brand page format
195
+ return `/page/${encodeURIComponent(firstPage.page_id)}`;
196
+
197
197
  }
198
-
198
+
199
199
  // Fallback if no pages exist
200
200
  return null;
201
201
  };
202
202
 
203
203
  const Card = ({ item, large = false }: { item: BrandItem; large?: boolean }) => (
204
204
  <a
205
- href={buildBrandHref(item)|| undefined}
205
+ href={buildBrandHref(item) || undefined}
206
206
  style={{ textDecoration: 'none', color: 'inherit', height: '100%', display: 'block' }}
207
207
  >
208
208
  <div
@@ -244,154 +244,167 @@ const GroupBrandComponent: React.FC<GroupBrandComponentMainProps> = ({ props, de
244
244
  );
245
245
 
246
246
  return (
247
- <div
248
- style={{
249
- border: '1px solid #e1e1e1',
250
- width: '100%',
251
- maxWidth: '100%',
252
- borderRadius: '0px',
253
- minHeight: '100px',
254
- position: 'relative',
255
- overflow: 'visible',
256
- marginBottom: '20px',
257
- marginTop: '0px',
258
- display: 'flex',
259
- flexDirection: 'column',
260
- height: '100%'
261
- }}
262
- className='GroupBrandComponent'
263
- >
264
- {showHeader && (
265
- <div
266
- className="groupBrandHeader"
267
- style={{
268
- backgroundColor: props.headerBackground,
269
- padding: '12px 16px',
270
- borderRadius: '0px',
271
- marginBottom: '4px',
272
- display: 'flex',
273
- alignItems: 'center',
274
- justifyContent: 'space-between',
275
- flexWrap: 'wrap',
276
- gap: '12px',
277
- }}
278
- >
279
- <p style={{
280
- color: props.headerTextStyle.fontColor,
281
- fontSize: `${props.headerTextStyle.fontSize}px`,
282
- fontWeight: props.headerTextStyle.isBold ? 'bold' : 'normal',
283
- fontStyle: props.headerTextStyle.isItalic ? 'italic' : 'normal',
284
- textDecoration: props.headerTextStyle.isUnderline ? 'underline' : 'none',
285
- margin: 0
286
- }}>
287
- {props.headerText || 'Brands'}
288
- </p>
289
-
290
- {currentLayout === 'NONE' && brands.length > 0 && (
291
- <div style={{ display: 'flex', gap: '8px' }}>
292
- <button
293
- onClick={scrollLeft}
294
- style={{
295
- width: '32px',
296
- height: '32px',
297
- borderRadius: '50%',
298
- border: '1px solid #ddd',
299
- backgroundColor: '#fff',
300
- cursor: 'pointer',
301
- display: 'flex',
302
- alignItems: 'center',
303
- justifyContent: 'center',
304
- fontSize: '16px',
305
- fontWeight: 'bold'
306
- }}
307
- onMouseOver={(e) => { e.currentTarget.style.backgroundColor = '#f8f9fa'; }}
308
- onMouseOut={(e) => { e.currentTarget.style.backgroundColor = '#fff'; }}
309
- >
310
-
311
- </button>
312
- <button
313
- onClick={scrollRight}
314
- style={{
315
- width: '32px',
316
- height: '32px',
317
- borderRadius: '50%',
318
- border: '1px solid #ddd',
319
- backgroundColor: '#fff',
320
- cursor: 'pointer',
321
- display: 'flex',
322
- alignItems: 'center',
323
- justifyContent: 'center',
324
- fontSize: '16px',
325
- fontWeight: 'bold'
326
- }}
327
- onMouseOver={(e) => { e.currentTarget.style.backgroundColor = '#f8f9fa'; }}
328
- onMouseOut={(e) => { e.currentTarget.style.backgroundColor = '#fff'; }}
329
- >
330
-
331
- </button>
332
- </div>
333
- )}
334
- </div>
335
- )}
336
-
247
+ <>
248
+ <style>
249
+ {`
250
+ .groupBrandCarousel::-webkit-scrollbar {
251
+ display: none;
252
+ }
253
+ .groupBrandCarousel {
254
+ scrollbar-width: none;
255
+ -ms-overflow-style: none;
256
+ }
257
+ `}
258
+ </style>
337
259
  <div
338
260
  style={{
339
- display: currentLayout === 'NONE' ? 'flex' : 'block',
340
- overflowX: currentLayout === 'NONE' ? (isHorizontalScroll ? 'auto' : 'hidden') : 'visible',
341
- overflowY: currentLayout === 'NONE' ? 'hidden' : 'visible',
342
- alignItems: currentLayout === 'NONE' ? 'stretch' : undefined,
343
- gap: currentLayout === 'NONE' ? '12px' : '0',
344
- padding: '12px',
345
- scrollBehavior: 'smooth',
346
- backgroundColor: props.cardColor || '#fff',
347
- borderRadius: '8px',
261
+ border: '1px solid #e1e1e1',
262
+ width: '100%',
263
+ maxWidth: '100%',
264
+ borderRadius: '0px',
265
+ minHeight: '100px',
348
266
  position: 'relative',
349
- flex: 1,
350
- minHeight: 0,
267
+ overflow: 'visible',
268
+ marginBottom: '20px',
269
+ marginTop: '0px',
270
+ display: 'flex',
271
+ flexDirection: 'column',
272
+ height: '100%'
351
273
  }}
352
- className="groupBrandCarousel"
274
+ className='GroupBrandComponent'
353
275
  >
354
- {brands.length > 0 ? (
355
- currentLayout === 'NONE' ? (
356
- brands.map((brand) => (
357
- <div key={brand.code} style={{ minWidth: '150px', width: '150px', flexShrink: 0, display: 'flex', flexDirection: 'column', height: '100%' }}>
358
- <Card item={brand} />
276
+ {showHeader && (
277
+ <div
278
+ className="groupBrandHeader"
279
+ style={{
280
+ backgroundColor: props.headerBackground,
281
+ padding: '12px 16px',
282
+ borderRadius: '0px',
283
+ marginBottom: '4px',
284
+ display: 'flex',
285
+ alignItems: 'center',
286
+ justifyContent: 'space-between',
287
+ flexWrap: 'wrap',
288
+ gap: '12px',
289
+ }}
290
+ >
291
+ <p style={{
292
+ color: props.headerTextStyle.fontColor,
293
+ fontSize: `${props.headerTextStyle.fontSize}px`,
294
+ fontWeight: props.headerTextStyle.isBold ? 'bold' : 'normal',
295
+ fontStyle: props.headerTextStyle.isItalic ? 'italic' : 'normal',
296
+ textDecoration: props.headerTextStyle.isUnderline ? 'underline' : 'none',
297
+ margin: 0
298
+ }}>
299
+ {props.headerText || 'Brands'}
300
+ </p>
301
+
302
+ {currentLayout === 'NONE' && brands.length > 0 && (
303
+ <div style={{ display: 'flex', gap: '8px' }}>
304
+ <button
305
+ onClick={scrollLeft}
306
+ style={{
307
+ width: '32px',
308
+ height: '32px',
309
+ borderRadius: '50%',
310
+ border: '1px solid #ddd',
311
+ backgroundColor: '#fff',
312
+ cursor: 'pointer',
313
+ display: 'flex',
314
+ alignItems: 'center',
315
+ justifyContent: 'center',
316
+ fontSize: '16px',
317
+ fontWeight: 'bold'
318
+ }}
319
+ onMouseOver={(e) => { e.currentTarget.style.backgroundColor = '#f8f9fa'; }}
320
+ onMouseOut={(e) => { e.currentTarget.style.backgroundColor = '#fff'; }}
321
+ >
322
+
323
+ </button>
324
+ <button
325
+ onClick={scrollRight}
326
+ style={{
327
+ width: '32px',
328
+ height: '32px',
329
+ borderRadius: '50%',
330
+ border: '1px solid #ddd',
331
+ backgroundColor: '#fff',
332
+ cursor: 'pointer',
333
+ display: 'flex',
334
+ alignItems: 'center',
335
+ justifyContent: 'center',
336
+ fontSize: '16px',
337
+ fontWeight: 'bold'
338
+ }}
339
+ onMouseOver={(e) => { e.currentTarget.style.backgroundColor = '#f8f9fa'; }}
340
+ onMouseOut={(e) => { e.currentTarget.style.backgroundColor = '#fff'; }}
341
+ >
342
+
343
+ </button>
359
344
  </div>
360
- ))
361
- ) : currentLayout === 'SMALL' ? (
362
- <div style={{ display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: '16px', padding: '8px' }}>
363
- {brands.map((brand) => (
364
- <Card key={brand.code} item={brand} />
365
- ))}
366
- </div>
367
- ) : currentLayout === 'MEDIUM' ? (
368
- <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: '16px', padding: '8px' }}>
369
- {brands.map((brand) => (
370
- <Card key={brand.code} item={brand} />
371
- ))}
372
- </div>
373
- ) : currentLayout === 'MEDIUM_THREE' ? (
374
- <div style={{ display: 'flex', flexDirection: 'column', gap: '16px', padding: '8px' }}>
375
- {brands.length > 0 && (
376
- <Card item={brands[0]} large />
377
- )}
378
- {brands.length > 1 && (
379
- <div style={{ display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: '16px' }}>
380
- {brands.slice(1).map((brand) => (
381
- <Card key={brand.code} item={brand} />
382
- ))}
383
- </div>
384
- )}
385
- </div>
386
- ) : null
387
- ) : (
388
- <div style={{ textAlign: 'center', color: '#666', padding: '40px', width: '100%', border: '2px dashed #ddd', borderRadius: '8px', backgroundColor: '#f9f9f9' }}>
389
- <p>No brands available.</p>
345
+ )}
390
346
  </div>
391
347
  )}
348
+
349
+ <div
350
+ style={{
351
+ display: currentLayout === 'NONE' ? 'flex' : 'block',
352
+ overflowX: currentLayout === 'NONE' ? (isHorizontalScroll ? 'auto' : 'hidden') : 'visible',
353
+ overflowY: currentLayout === 'NONE' ? 'hidden' : 'visible',
354
+ alignItems: currentLayout === 'NONE' ? 'stretch' : undefined,
355
+ gap: currentLayout === 'NONE' ? '12px' : '0',
356
+ padding: '12px',
357
+ scrollBehavior: 'smooth',
358
+ backgroundColor: props.cardColor || '#fff',
359
+ borderRadius: '8px',
360
+ position: 'relative',
361
+ flex: 1,
362
+ minHeight: 0,
363
+ }}
364
+ className="groupBrandCarousel"
365
+ >
366
+ {brands.length > 0 ? (
367
+ currentLayout === 'NONE' ? (
368
+ brands.map((brand) => (
369
+ <div key={brand.code} style={{ minWidth: '150px', width: '150px', flexShrink: 0, display: 'flex', flexDirection: 'column', height: '100%' }}>
370
+ <Card item={brand} />
371
+ </div>
372
+ ))
373
+ ) : currentLayout === 'SMALL' ? (
374
+ <div style={{ display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: '16px', padding: '8px' }}>
375
+ {brands.map((brand) => (
376
+ <Card key={brand.code} item={brand} />
377
+ ))}
378
+ </div>
379
+ ) : currentLayout === 'MEDIUM' ? (
380
+ <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: '16px', padding: '8px' }}>
381
+ {brands.map((brand) => (
382
+ <Card key={brand.code} item={brand} />
383
+ ))}
384
+ </div>
385
+ ) : currentLayout === 'MEDIUM_THREE' ? (
386
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '16px', padding: '8px' }}>
387
+ {brands.length > 0 && (
388
+ <Card item={brands[0]} large />
389
+ )}
390
+ {brands.length > 1 && (
391
+ <div style={{ display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: '16px' }}>
392
+ {brands.slice(1).map((brand) => (
393
+ <Card key={brand.code} item={brand} />
394
+ ))}
395
+ </div>
396
+ )}
397
+ </div>
398
+ ) : null
399
+ ) : (
400
+ <div style={{ textAlign: 'center', color: '#666', padding: '40px', width: '100%', border: '2px dashed #ddd', borderRadius: '8px', backgroundColor: '#f9f9f9' }}>
401
+ <p>No brands available.</p>
402
+ </div>
403
+ )}
404
+ </div>
392
405
  </div>
393
- </div>
406
+ </>
394
407
  );
395
408
  };
396
409
 
397
- export default GroupBrandComponent
410
+ export default GroupBrandComponent;