tee3apps-cms-sdk-react 0.0.32 → 0.0.34

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.
@@ -135,11 +135,11 @@ const GroupCategoryComponent: React.FC<GroupCategoryComponentMainProps> = ({ pro
135
135
  const getCurrentLayout = () => {
136
136
  if (!props.layout) return 'NONE';
137
137
  switch (deviceMode) {
138
- case 'mobileweb': return props.layout.mobileweb ;
139
- case 'mobileapp': return props.layout.mobileapp ;
140
- case 'tablet': return props.layout.tablet ;
138
+ case 'mobileweb': return props.layout.mobileweb;
139
+ case 'mobileapp': return props.layout.mobileapp;
140
+ case 'tablet': return props.layout.tablet;
141
141
  case 'web':
142
- default: return props.layout.web ;
142
+ default: return props.layout.web;
143
143
  }
144
144
  };
145
145
 
@@ -186,247 +186,260 @@ const GroupCategoryComponent: React.FC<GroupCategoryComponentMainProps> = ({ pro
186
186
  };
187
187
 
188
188
  const buildCategoryHref = (item: CategoryItem): string | null => {
189
- if (item.pages && item.pages.length > 0) {
190
- const firstPage = item.pages[0];
189
+ if (item.pages && item.pages.length > 0) {
190
+ const firstPage = item.pages[0];
191
191
  console.log(firstPage.page_id);
192
- // Return only if page is active
193
- if (firstPage.page_id) {
194
- return `/page/${encodeURIComponent(firstPage.page_id)}?type=category`;
195
- }
196
- }
197
-
198
- // No valid active page — don't return href
199
- return null;
200
- };
201
-
202
- const Card = ({ item, large = false }: { item: CategoryItem; large?: boolean }) => {
203
- const href = buildCategoryHref(item);
204
- const Wrapper: React.FC<{ children: React.ReactNode }> = ({ children }) =>
205
- href ? (
206
- <a href={href} style={{ textDecoration: 'none', color: 'inherit', height: '100%', display: 'block' }}>
207
- {children}
208
- </a>
209
- ) : (
210
- <>{children}</>
211
- );
212
- return (
213
- <Wrapper>
214
- <div
215
- className="categoryCard"
216
- style={{
217
- height: '100%',
218
- borderRadius: '8px',
219
- overflow: 'hidden',
220
- border: '1px solid #eee',
221
- backgroundColor: '#fff',
222
- display: 'flex',
223
- flexDirection: 'column',
224
- alignItems: 'center',
225
- justifyContent: 'flex-start',
226
- padding: large ? '16px' : '12px',
227
- boxShadow: '0 2px 4px rgba(0,0,0,0.1)',
228
- transition: 'transform 0.2s ease',
229
- cursor: href ? 'pointer' : 'default',
230
- }}
231
- onMouseOver={(e) => {
232
- (e.currentTarget as HTMLDivElement).style.transform = 'translateY(-2px)';
233
- (e.currentTarget as HTMLDivElement).style.boxShadow = '0 4px 8px rgba(0,0,0,0.15)';
234
- }}
235
- onMouseOut={(e) => {
236
- (e.currentTarget as HTMLDivElement).style.transform = 'translateY(0)';
237
- (e.currentTarget as HTMLDivElement).style.boxShadow = '0 2px 4px rgba(0,0,0,0.1)';
238
- }}
239
- >
240
- {item.image && (
241
- <div
242
- style={{
243
- height: large ? '160px' : '120px',
244
- width: '100%',
245
- display: 'flex',
246
- alignItems: 'center',
247
- justifyContent: 'center',
248
- marginBottom: large ? '12px' : '8px',
249
- }}
250
- >
251
- <img
252
- src={getImageUrl(item.image.url)}
253
- alt={item.image.alt || getCategoryName(item.name) || ''}
254
- style={{ width: '100%', height: '100%', objectFit: 'contain' }}
255
- />
256
- </div>
257
- )}
192
+ // Return only if page is active
193
+ if (firstPage.page_id) {
194
+ return `/page/${encodeURIComponent(firstPage.page_id)}?type=category`;
195
+ }
196
+ }
258
197
 
259
- {showCategoryName && (
260
- <div
261
- style={{
262
- textAlign: 'center',
263
- fontSize: large ? '16px' : '14px',
264
- fontWeight: large ? 600 : 500,
265
- color: '#333',
266
- lineHeight: '1.4',
267
- height: large ? 'auto' : '40px',
268
- overflow: 'hidden',
269
- display: large ? 'block' : '-webkit-box',
270
- WebkitLineClamp: large ? undefined : 2,
271
- WebkitBoxOrient: 'vertical',
272
- }}
273
- >
274
- {getCategoryName(item.name)}
275
- </div>
276
- )}
277
- </div>
278
- </Wrapper>
279
- );
280
- };
198
+ // No valid active page — don't return href
199
+ return null;
200
+ };
281
201
 
282
- return (
283
- <div
284
- style={{
285
- border: '1px solid #e1e1e1',
286
- width: '100%',
287
- maxWidth: '100%',
288
- borderRadius: '0px',
289
- minHeight: '100px',
290
- position: 'relative',
291
- overflow: 'visible',
292
- marginBottom: '20px',
293
- marginTop: '0px',
294
- display: 'flex',
295
- flexDirection: 'column',
296
- height: '100%'
297
- }}
298
- className='GroupCategoryComponent'
299
- >
300
- {showHeader && (
202
+ const Card = ({ item, large = false }: { item: CategoryItem; large?: boolean }) => {
203
+ const href = buildCategoryHref(item);
204
+ const Wrapper: React.FC<{ children: React.ReactNode }> = ({ children }) =>
205
+ href ? (
206
+ <a href={href} style={{ textDecoration: 'none', color: 'inherit', height: '100%', display: 'block' }}>
207
+ {children}
208
+ </a>
209
+ ) : (
210
+ <>{children}</>
211
+ );
212
+ return (
213
+ <Wrapper>
301
214
  <div
302
- className="groupCategoryHeader"
215
+ className="categoryCard"
303
216
  style={{
304
- backgroundColor: props.headerBackground,
305
- padding: '12px 16px',
306
- borderRadius: '0px',
307
- marginBottom: '4px',
217
+ height: '100%',
218
+ borderRadius: '8px',
219
+ overflow: 'hidden',
220
+ border: '1px solid #eee',
221
+ backgroundColor: '#fff',
308
222
  display: 'flex',
223
+ flexDirection: 'column',
309
224
  alignItems: 'center',
310
- justifyContent: 'space-between',
311
- flexWrap: 'wrap',
312
- gap: '12px',
225
+ justifyContent: 'flex-start',
226
+ padding: large ? '16px' : '12px',
227
+ boxShadow: '0 2px 4px rgba(0,0,0,0.1)',
228
+ transition: 'transform 0.2s ease',
229
+ cursor: href ? 'pointer' : 'default',
230
+ }}
231
+ onMouseOver={(e) => {
232
+ (e.currentTarget as HTMLDivElement).style.transform = 'translateY(-2px)';
233
+ (e.currentTarget as HTMLDivElement).style.boxShadow = '0 4px 8px rgba(0,0,0,0.15)';
234
+ }}
235
+ onMouseOut={(e) => {
236
+ (e.currentTarget as HTMLDivElement).style.transform = 'translateY(0)';
237
+ (e.currentTarget as HTMLDivElement).style.boxShadow = '0 2px 4px rgba(0,0,0,0.1)';
313
238
  }}
314
239
  >
315
- <p style={{
316
- color: props.headerTextStyle.fontColor,
317
- fontSize: `${props.headerTextStyle.fontSize}px`,
318
- fontWeight: props.headerTextStyle.isBold ? 'bold' : 'normal',
319
- fontStyle: props.headerTextStyle.isItalic ? 'italic' : 'normal',
320
- textDecoration: props.headerTextStyle.isUnderline ? 'underline' : 'none',
321
- margin: 0
322
- }}>
323
- {props.nameData || 'Categories'}
324
- </p>
240
+ {item.image && (
241
+ <div
242
+ style={{
243
+ height: large ? '160px' : '120px',
244
+ width: '100%',
245
+ display: 'flex',
246
+ alignItems: 'center',
247
+ justifyContent: 'center',
248
+ marginBottom: large ? '12px' : '8px',
249
+ }}
250
+ >
251
+ <img
252
+ src={getImageUrl(item.image.url)}
253
+ alt={item.image.alt || getCategoryName(item.name) || ''}
254
+ style={{ width: '100%', height: '100%', objectFit: 'contain' }}
255
+ />
256
+ </div>
257
+ )}
325
258
 
326
- {currentLayout === 'NONE' && categories.length > 0 && (
327
- <div style={{ display: 'flex', gap: '8px' }}>
328
- <button
329
- onClick={scrollLeft}
330
- style={{
331
- width: '32px',
332
- height: '32px',
333
- borderRadius: '50%',
334
- border: '1px solid #ddd',
335
- backgroundColor: '#fff',
336
- cursor: 'pointer',
337
- display: 'flex',
338
- alignItems: 'center',
339
- justifyContent: 'center',
340
- fontSize: '16px',
341
- fontWeight: 'bold'
342
- }}
343
- onMouseOver={(e) => { e.currentTarget.style.backgroundColor = '#f8f9fa'; }}
344
- onMouseOut={(e) => { e.currentTarget.style.backgroundColor = '#fff'; }}
345
- >
346
-
347
- </button>
348
- <button
349
- onClick={scrollRight}
350
- style={{
351
- width: '32px',
352
- height: '32px',
353
- borderRadius: '50%',
354
- border: '1px solid #ddd',
355
- backgroundColor: '#fff',
356
- cursor: 'pointer',
357
- display: 'flex',
358
- alignItems: 'center',
359
- justifyContent: 'center',
360
- fontSize: '16px',
361
- fontWeight: 'bold'
362
- }}
363
- onMouseOver={(e) => { e.currentTarget.style.backgroundColor = '#f8f9fa'; }}
364
- onMouseOut={(e) => { e.currentTarget.style.backgroundColor = '#fff'; }}
365
- >
366
-
367
- </button>
259
+ {showCategoryName && (
260
+ <div
261
+ style={{
262
+ textAlign: 'center',
263
+ fontSize: large ? '16px' : '14px',
264
+ fontWeight: large ? 600 : 500,
265
+ color: '#333',
266
+ lineHeight: '1.4',
267
+ height: large ? 'auto' : '40px',
268
+ overflow: 'hidden',
269
+ display: large ? 'block' : '-webkit-box',
270
+ WebkitLineClamp: large ? undefined : 2,
271
+ WebkitBoxOrient: 'vertical',
272
+ }}
273
+ >
274
+ {getCategoryName(item.name)}
368
275
  </div>
369
276
  )}
370
277
  </div>
371
- )}
278
+ </Wrapper>
279
+ );
280
+ };
372
281
 
282
+ return (
283
+ <>
284
+ <style>
285
+ {`
286
+ .groupCategoryCarousel::-webkit-scrollbar {
287
+ display: none;
288
+ }
289
+ .groupCategoryCarousel {
290
+ scrollbar-width: none;
291
+ -ms-overflow-style: none;
292
+ }
293
+ `}
294
+ </style>
373
295
  <div
374
296
  style={{
375
- display: currentLayout === 'NONE' ? 'flex' : 'block',
376
- overflowX: currentLayout === 'NONE' ? (isHorizontalScroll ? 'auto' : 'hidden') : 'visible',
377
- overflowY: currentLayout === 'NONE' ? 'hidden' : 'visible',
378
- alignItems: currentLayout === 'NONE' ? 'stretch' : undefined,
379
- gap: currentLayout === 'NONE' ? '12px' : '0',
380
- padding: '12px',
381
- scrollBehavior: 'smooth',
382
- backgroundColor: props.carouselBackground || '#fff',
383
- borderRadius: '8px',
297
+ border: '1px solid #e1e1e1',
298
+ width: '100%',
299
+ maxWidth: '100%',
300
+ borderRadius: '0px',
301
+ minHeight: '100px',
384
302
  position: 'relative',
385
- flex: 1,
386
- minHeight: 0,
303
+ overflow: 'visible',
304
+ marginBottom: '20px',
305
+ marginTop: '0px',
306
+ display: 'flex',
307
+ flexDirection: 'column',
308
+ height: '100%'
387
309
  }}
388
- className="groupCategoryCarousel"
310
+ className='GroupCategoryComponent'
389
311
  >
390
- {categories.length > 0 ? (
391
- currentLayout === 'NONE' ? (
392
- categories.map((category) => (
393
- <div key={category.code} style={{ minWidth: '150px', width: '150px', flexShrink: 0, display: 'flex', flexDirection: 'column', height: '100%' }}>
394
- <Card item={category} />
312
+ {showHeader && (
313
+ <div
314
+ className="groupCategoryHeader"
315
+ style={{
316
+ backgroundColor: props.headerBackground,
317
+ padding: '12px 16px',
318
+ borderRadius: '0px',
319
+ marginBottom: '4px',
320
+ display: 'flex',
321
+ alignItems: 'center',
322
+ justifyContent: 'space-between',
323
+ flexWrap: 'wrap',
324
+ gap: '12px',
325
+ }}
326
+ >
327
+ <p style={{
328
+ color: props.headerTextStyle.fontColor,
329
+ fontSize: `${props.headerTextStyle.fontSize}px`,
330
+ fontWeight: props.headerTextStyle.isBold ? 'bold' : 'normal',
331
+ fontStyle: props.headerTextStyle.isItalic ? 'italic' : 'normal',
332
+ textDecoration: props.headerTextStyle.isUnderline ? 'underline' : 'none',
333
+ margin: 0
334
+ }}>
335
+ {props.nameData || 'Categories'}
336
+ </p>
337
+
338
+ {currentLayout === 'NONE' && categories.length > 0 && (
339
+ <div style={{ display: 'flex', gap: '8px' }}>
340
+ <button
341
+ onClick={scrollLeft}
342
+ style={{
343
+ width: '32px',
344
+ height: '32px',
345
+ borderRadius: '50%',
346
+ border: '1px solid #ddd',
347
+ backgroundColor: '#fff',
348
+ cursor: 'pointer',
349
+ display: 'flex',
350
+ alignItems: 'center',
351
+ justifyContent: 'center',
352
+ fontSize: '16px',
353
+ fontWeight: 'bold'
354
+ }}
355
+ onMouseOver={(e) => { e.currentTarget.style.backgroundColor = '#f8f9fa'; }}
356
+ onMouseOut={(e) => { e.currentTarget.style.backgroundColor = '#fff'; }}
357
+ >
358
+
359
+ </button>
360
+ <button
361
+ onClick={scrollRight}
362
+ style={{
363
+ width: '32px',
364
+ height: '32px',
365
+ borderRadius: '50%',
366
+ border: '1px solid #ddd',
367
+ backgroundColor: '#fff',
368
+ cursor: 'pointer',
369
+ display: 'flex',
370
+ alignItems: 'center',
371
+ justifyContent: 'center',
372
+ fontSize: '16px',
373
+ fontWeight: 'bold'
374
+ }}
375
+ onMouseOver={(e) => { e.currentTarget.style.backgroundColor = '#f8f9fa'; }}
376
+ onMouseOut={(e) => { e.currentTarget.style.backgroundColor = '#fff'; }}
377
+ >
378
+
379
+ </button>
395
380
  </div>
396
- ))
397
- ) : currentLayout === 'SMALL' ? (
398
- <div style={{ display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: '16px', padding: '8px' }}>
399
- {categories.map((category) => (
400
- <Card key={category.code} item={category} />
401
- ))}
402
- </div>
403
- ) : currentLayout === 'MEDIUM' ? (
404
- <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: '16px', padding: '8px' }}>
405
- {categories.map((category) => (
406
- <Card key={category.code} item={category} />
407
- ))}
408
- </div>
409
- ) : currentLayout === 'MEDIUM_THREE' ? (
410
- <div style={{ display: 'flex', flexDirection: 'column', gap: '16px', padding: '8px' }}>
411
- {categories.length > 0 && (
412
- <Card item={categories[0]} large />
413
- )}
414
- {categories.length > 1 && (
415
- <div style={{ display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: '16px' }}>
416
- {categories.slice(1).map((category) => (
417
- <Card key={category.code} item={category} />
418
- ))}
419
- </div>
420
- )}
421
- </div>
422
- ) : null
423
- ) : (
424
- <div style={{ textAlign: 'center', color: '#666', padding: '40px', width: '100%', border: '2px dashed #ddd', borderRadius: '8px', backgroundColor: '#f9f9f9' }}>
425
- <p>No categories available.</p>
381
+ )}
426
382
  </div>
427
383
  )}
384
+
385
+ <div
386
+ style={{
387
+ display: currentLayout === 'NONE' ? 'flex' : 'block',
388
+ overflowX: currentLayout === 'NONE' ? (isHorizontalScroll ? 'auto' : 'hidden') : 'visible',
389
+ overflowY: currentLayout === 'NONE' ? 'hidden' : 'visible',
390
+ alignItems: currentLayout === 'NONE' ? 'stretch' : undefined,
391
+ gap: currentLayout === 'NONE' ? '12px' : '0',
392
+ padding: '12px',
393
+ scrollBehavior: 'smooth',
394
+ backgroundColor: props.carouselBackground || '#fff',
395
+ borderRadius: '8px',
396
+ position: 'relative',
397
+ flex: 1,
398
+ minHeight: 0,
399
+ }}
400
+ className="groupCategoryCarousel"
401
+ >
402
+ {categories.length > 0 ? (
403
+ currentLayout === 'NONE' ? (
404
+ categories.map((category) => (
405
+ <div key={category.code} style={{ minWidth: '150px', width: '150px', flexShrink: 0, display: 'flex', flexDirection: 'column', height: '100%' }}>
406
+ <Card item={category} />
407
+ </div>
408
+ ))
409
+ ) : currentLayout === 'SMALL' ? (
410
+ <div style={{ display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: '16px', padding: '8px' }}>
411
+ {categories.map((category) => (
412
+ <Card key={category.code} item={category} />
413
+ ))}
414
+ </div>
415
+ ) : currentLayout === 'MEDIUM' ? (
416
+ <div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: '16px', padding: '8px' }}>
417
+ {categories.map((category) => (
418
+ <Card key={category.code} item={category} />
419
+ ))}
420
+ </div>
421
+ ) : currentLayout === 'MEDIUM_THREE' ? (
422
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '16px', padding: '8px' }}>
423
+ {categories.length > 0 && (
424
+ <Card item={categories[0]} large />
425
+ )}
426
+ {categories.length > 1 && (
427
+ <div style={{ display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: '16px' }}>
428
+ {categories.slice(1).map((category) => (
429
+ <Card key={category.code} item={category} />
430
+ ))}
431
+ </div>
432
+ )}
433
+ </div>
434
+ ) : null
435
+ ) : (
436
+ <div style={{ textAlign: 'center', color: '#666', padding: '40px', width: '100%', border: '2px dashed #ddd', borderRadius: '8px', backgroundColor: '#f9f9f9' }}>
437
+ <p>No categories available.</p>
438
+ </div>
439
+ )}
440
+ </div>
428
441
  </div>
429
- </div>
442
+ </>
430
443
  );
431
444
  };
432
445