tee3apps-cms-sdk-react 0.0.18 → 0.0.19

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.
@@ -129,6 +129,24 @@ const TabComponent: React.FC<TabComponentMainProps> = ({ props, deviceMode = 'we
129
129
  const [activeTab, setActiveTab] = useState(0);
130
130
  const [carouselIndex, setCarouselIndex] = useState(0);
131
131
 
132
+ // Check if tab content contains image/video components for dynamic height
133
+ const hasMediaComponents = (): boolean => {
134
+ if (!props.tabs || props.tabs.length === 0) return false;
135
+
136
+ const activeTabData = props.tabs[activeTab];
137
+ if (!activeTabData) return false;
138
+
139
+ // Check tab content type
140
+ const contentType = activeTabData.tabContentType;
141
+ const mediaContentTypes = ['IMAGE', 'VIDEO', 'GROUPIMAGE', 'GROUPVIDEO'];
142
+
143
+ if (contentType && mediaContentTypes.includes(contentType)) {
144
+ return true;
145
+ }
146
+
147
+ return false;
148
+ };
149
+
132
150
  const buildLinkForSlide = (slide: any) => {
133
151
  switch (slide.link_type) {
134
152
  case 'NONE':
@@ -474,7 +492,7 @@ const TabComponent: React.FC<TabComponentMainProps> = ({ props, deviceMode = 'we
474
492
  gridTemplateColumns: getGridColumns(),
475
493
  gridTemplateRows: getGridRows(),
476
494
  gap: '3px',
477
- height: `${props.height}px`, // force tab content height
495
+ width: '100%',
478
496
  overflow: 'hidden'
479
497
  };
480
498
 
@@ -497,15 +515,14 @@ const TabComponent: React.FC<TabComponentMainProps> = ({ props, deviceMode = 'we
497
515
 
498
516
  const imageElement = (
499
517
  <div style={contentStyle}>
500
- <div className="media-box" style={{ width: '100%', height: '100%', overflow: 'hidden' }}>
518
+ <div className="media-box" style={{ width: '100%', overflow: 'hidden' }}>
501
519
  <img
502
520
  src={fullImageUrl}
503
521
  alt={imageAlt}
504
522
  className="media-content"
505
523
  style={{
506
524
  width: '100%',
507
- height: '100%',
508
- objectFit: 'cover',
525
+ height: 'auto',
509
526
  display: 'block'
510
527
  }}
511
528
  onError={(e) => {
@@ -537,12 +554,12 @@ const TabComponent: React.FC<TabComponentMainProps> = ({ props, deviceMode = 'we
537
554
  if (tab.tabContentVideo) {
538
555
  return (
539
556
  <div style={contentStyle}>
540
- <div className="media-box">
557
+ <div className="media-box" style={{ width: '100%', overflow: 'hidden' }}>
541
558
  <video
542
559
  src={getImageUrl(tab.tabContentVideo.video.url)}
543
560
  controls
544
561
  className="media-content"
545
-
562
+ style={{ width: '100%', height: 'auto', display: 'block' }}
546
563
  />
547
564
  </div>
548
565
  </div>
@@ -567,7 +584,7 @@ const TabComponent: React.FC<TabComponentMainProps> = ({ props, deviceMode = 'we
567
584
  const linkUrl = currentImage ? buildLinkForSlide(currentImage) : null;
568
585
 
569
586
  const imageElement = currentImage ? (
570
- <div className="media-box">
587
+ <div className="media-box" style={{ width: '100%', overflow: 'hidden' }}>
571
588
  <img
572
589
  src={getImageUrl(
573
590
  tab.tabContentGroupImage.type === 'DYNAMIC'
@@ -580,6 +597,7 @@ const TabComponent: React.FC<TabComponentMainProps> = ({ props, deviceMode = 'we
580
597
  : currentImage.attr?.alt
581
598
  }
582
599
  className="media-content"
600
+ style={{ width: '100%', height: 'auto', display: 'block' }}
583
601
  />
584
602
  </div>
585
603
  ) : null;
@@ -589,11 +607,7 @@ const TabComponent: React.FC<TabComponentMainProps> = ({ props, deviceMode = 'we
589
607
  style={{
590
608
  position: 'relative',
591
609
  width: '100%',
592
- height: 'auto',
593
610
  overflow: 'hidden',
594
- display: 'flex',
595
- alignItems: 'center',
596
- justifyContent: 'center',
597
611
  }}
598
612
  >
599
613
  {linkUrl ? (
@@ -604,7 +618,7 @@ const TabComponent: React.FC<TabComponentMainProps> = ({ props, deviceMode = 'we
604
618
  ? currentImage.external_link?.target || '_blank'
605
619
  : '_self'
606
620
  }
607
- style={{ width: '100%', height: '100%' }}
621
+ style={{ width: '100%', display: 'block' }}
608
622
  >
609
623
  {imageElement}
610
624
  </a>
@@ -738,7 +752,7 @@ const TabComponent: React.FC<TabComponentMainProps> = ({ props, deviceMode = 'we
738
752
  gridTemplateColumns: getGridColumns(),
739
753
  gridTemplateRows: getGridRows(),
740
754
  gap: '3px',
741
- height: '100%', // Use auto height for group images
755
+ width: '100%',
742
756
  overflow: 'hidden'
743
757
  };
744
758
 
@@ -747,11 +761,7 @@ const TabComponent: React.FC<TabComponentMainProps> = ({ props, deviceMode = 'we
747
761
  style={{
748
762
  position: 'relative',
749
763
  width: '100%',
750
- height: 'auto',
751
764
  overflow: 'hidden',
752
- display: 'flex',
753
- alignItems: 'center',
754
- justifyContent: 'center',
755
765
  }}
756
766
  >
757
767
  <div style={groupImageContentStyle} className='media-box'>
@@ -759,7 +769,7 @@ const TabComponent: React.FC<TabComponentMainProps> = ({ props, deviceMode = 'we
759
769
  const originalIndex = displayIndices[displayIndex];
760
770
  const linkUrl = buildLinkForSlide(image);
761
771
  const imageElement = (
762
- <div key={originalIndex} className="media-box">
772
+ <div key={originalIndex} className="media-box" style={{ width: '100%', overflow: 'hidden' }}>
763
773
  <img
764
774
  src={getImageUrl(
765
775
  tab.tabContentGroupImage.type === 'DYNAMIC'
@@ -772,6 +782,7 @@ const TabComponent: React.FC<TabComponentMainProps> = ({ props, deviceMode = 'we
772
782
  : image.attr?.alt
773
783
  }
774
784
  className="media-content"
785
+ style={{ width: '100%', height: 'auto', display: 'block' }}
775
786
  />
776
787
  </div>
777
788
  );
@@ -786,11 +797,12 @@ const TabComponent: React.FC<TabComponentMainProps> = ({ props, deviceMode = 'we
786
797
  : '_self'
787
798
  }
788
799
  className='media-box'
800
+ style={{ width: '100%', display: 'block' }}
789
801
  >
790
802
  {imageElement}
791
803
  </a>
792
804
  ) : (
793
- <div key={originalIndex} style={{ width: '100%', height: '100%' }}>
805
+ <div key={originalIndex} style={{ width: '100%' }}>
794
806
  {imageElement}
795
807
  </div>
796
808
  );
@@ -907,7 +919,7 @@ const TabComponent: React.FC<TabComponentMainProps> = ({ props, deviceMode = 'we
907
919
  const linkUrl = currentVideo ? buildLinkForSlide(currentVideo) : null;
908
920
 
909
921
  const videoElement = currentVideo ? (
910
- <div className="media-box">
922
+ <div className="media-box" style={{ width: '100%', overflow: 'hidden' }}>
911
923
  <video
912
924
  src={getImageUrl(
913
925
  tab.tabContentGroupVideo.type === 'DYNAMIC'
@@ -920,7 +932,7 @@ const TabComponent: React.FC<TabComponentMainProps> = ({ props, deviceMode = 'we
920
932
  : currentVideo.attr?.alt }
921
933
  className="media-content"
922
934
  controls
923
- style={{ width: '100%', height: 'auto', objectFit: 'cover' }}
935
+ style={{ width: '100%', height: 'auto', display: 'block' }}
924
936
  />
925
937
  </div>
926
938
  ) : null;
@@ -930,15 +942,11 @@ const TabComponent: React.FC<TabComponentMainProps> = ({ props, deviceMode = 'we
930
942
  style={{
931
943
  position: 'relative',
932
944
  width: '100%',
933
- height: 'auto',
934
945
  overflow: 'hidden',
935
- display: 'flex',
936
- alignItems: 'stretch',
937
- justifyContent: 'center',
938
946
  }}
939
947
  >
940
948
  {currentVideo && (
941
- <div style={{ width: '100%', height: '100%', display: 'flex' }}>
949
+ <div style={{ width: '100%' }}>
942
950
  {linkUrl ? (
943
951
  <a
944
952
  href={linkUrl}
@@ -947,7 +955,7 @@ const TabComponent: React.FC<TabComponentMainProps> = ({ props, deviceMode = 'we
947
955
  ? currentVideo.external_link?.target || '_blank'
948
956
  : '_self'
949
957
  }
950
- style={{ textDecoration: 'none', color: 'inherit', display: 'contents' }}
958
+ style={{ textDecoration: 'none', color: 'inherit', display: 'block', width: '100%' }}
951
959
  >
952
960
  {videoElement}
953
961
  </a>
@@ -1083,7 +1091,7 @@ const TabComponent: React.FC<TabComponentMainProps> = ({ props, deviceMode = 'we
1083
1091
  gridTemplateColumns: getGridColumns(),
1084
1092
  gridTemplateRows: getGridRows(),
1085
1093
  gap: '3px',
1086
- height: 'auto', // Use auto height for group videos
1094
+ width: '100%',
1087
1095
  overflow: 'hidden'
1088
1096
  };
1089
1097
 
@@ -1092,11 +1100,7 @@ const TabComponent: React.FC<TabComponentMainProps> = ({ props, deviceMode = 'we
1092
1100
  style={{
1093
1101
  position: 'relative',
1094
1102
  width: '100%',
1095
- height: 'auto',
1096
1103
  overflow: 'hidden',
1097
- display: 'flex',
1098
- alignItems: 'center',
1099
- justifyContent: 'center',
1100
1104
  }}
1101
1105
  >
1102
1106
  <div style={groupVideoContentStyle} className='media-box'>
@@ -1105,7 +1109,7 @@ const TabComponent: React.FC<TabComponentMainProps> = ({ props, deviceMode = 'we
1105
1109
  const linkUrl = buildLinkForSlide(video);
1106
1110
 
1107
1111
  const videoElement = (
1108
- <div key={originalIndex} className="media-box">
1112
+ <div key={originalIndex} className="media-box" style={{ width: '100%', overflow: 'hidden' }}>
1109
1113
  <video
1110
1114
  src={getImageUrl(
1111
1115
  tab.tabContentGroupVideo.type === 'DYNAMIC'
@@ -1119,7 +1123,7 @@ const TabComponent: React.FC<TabComponentMainProps> = ({ props, deviceMode = 'we
1119
1123
  }
1120
1124
  className="media-content"
1121
1125
  controls
1122
- style={{ width: '100%', height: 'auto', objectFit: 'cover' }}
1126
+ style={{ width: '100%', height: 'auto', display: 'block' }}
1123
1127
  />
1124
1128
  </div>
1125
1129
  );
@@ -1134,11 +1138,12 @@ const TabComponent: React.FC<TabComponentMainProps> = ({ props, deviceMode = 'we
1134
1138
  : '_self'
1135
1139
  }
1136
1140
  className='media-box'
1141
+ style={{ width: '100%', display: 'block' }}
1137
1142
  >
1138
1143
  {videoElement}
1139
1144
  </a>
1140
1145
  ) : (
1141
- <div key={originalIndex} style={{ width: '100%', height: '100%' }}>
1146
+ <div key={originalIndex} style={{ width: '100%' }}>
1142
1147
  {videoElement}
1143
1148
  </div>
1144
1149
  );
@@ -1258,15 +1263,11 @@ const TabComponent: React.FC<TabComponentMainProps> = ({ props, deviceMode = 'we
1258
1263
  style={{
1259
1264
  position: 'relative',
1260
1265
  width: '100%',
1261
- height: `${props.height}px`, // Full height of tab content
1262
1266
  overflow: 'hidden',
1263
- display: 'flex',
1264
- alignItems: 'stretch',
1265
- justifyContent: 'center',
1266
1267
  }}
1267
1268
  >
1268
1269
  {currentProduct && (
1269
- <div style={{ width: '100%', height: '100%', display: 'flex' }}>
1270
+ <div style={{ width: '100%' }}>
1270
1271
  <ProductCard product={currentProduct} layout={layout} />
1271
1272
  </div>
1272
1273
  )}
@@ -1435,11 +1436,7 @@ const TabComponent: React.FC<TabComponentMainProps> = ({ props, deviceMode = 'we
1435
1436
  style={{
1436
1437
  position: 'relative',
1437
1438
  width: '100%',
1438
- height: 'auto',
1439
1439
  overflow: 'hidden',
1440
- display: 'flex',
1441
- alignItems: 'center',
1442
- justifyContent: 'center',
1443
1440
  }}
1444
1441
  >
1445
1442
  <div style={groupProductContentStyle}>
@@ -1450,7 +1447,6 @@ const TabComponent: React.FC<TabComponentMainProps> = ({ props, deviceMode = 'we
1450
1447
  key={originalIndex}
1451
1448
  style={{
1452
1449
  width: '100%',
1453
- height: '100%',
1454
1450
  display: 'flex',
1455
1451
  alignItems: 'stretch',
1456
1452
  justifyContent: 'center',
@@ -1593,11 +1589,19 @@ const TabComponent: React.FC<TabComponentMainProps> = ({ props, deviceMode = 'we
1593
1589
  };
1594
1590
 
1595
1591
  const tabs = props.tabs || [];
1592
+
1593
+ // Get dynamic minHeight based on media components
1594
+ const getTabMinHeight = (): string | undefined => {
1595
+ if (hasMediaComponents()) {
1596
+ return undefined; // Remove minHeight constraint for media components
1597
+ }
1598
+ return `${props.height}px`;
1599
+ };
1596
1600
 
1597
1601
  return (
1598
1602
  <div style={{
1599
1603
  width: '100%',
1600
- minHeight: `${props.height}px`,
1604
+ minHeight: getTabMinHeight(),
1601
1605
  backgroundColor: '#ffffff',
1602
1606
  overflow: 'hidden',
1603
1607
  boxShadow: '0 4px 20px rgba(0,0,0,0.08)',
@@ -1,22 +1,17 @@
1
1
  .media-box {
2
2
  width: 100%;
3
- height: 100%;
4
- display: flex;
5
- justify-content: center;
6
- align-items: center;
7
- background-color: #f4f4f4;
8
3
  overflow: hidden;
4
+ display: block;
9
5
  }
10
6
 
11
7
  .media-content {
12
- height: 100%;
13
8
  width: 100%;
14
- object-fit: fill;
9
+ height: auto;
10
+ display: block;
15
11
  }
16
12
 
17
13
  /* Video specific styles */
18
14
  video.media-content {
19
- object-fit: cover;
20
15
  background-color: #000;
21
16
  }
22
17
 
package/src/index.css CHANGED
@@ -55,19 +55,18 @@ body {
55
55
  /* -------------- IMAGE STYLES --------------- */
56
56
 
57
57
  .image-box {
58
-
59
- width: 100%;
60
- /* height: 280px; */
58
+ width: 100%;
61
59
  overflow: hidden;
62
- display: flex;
63
- align-items: center;
64
- justify-content: center;
65
-
60
+ display: block;
61
+ position: relative;
62
+ max-height: 280px;
66
63
  }
67
64
 
68
65
  .fitted-image {
69
66
  width: 100%;
70
- height: 100%;
67
+ height: auto;
68
+ max-height: 280px;
69
+ display: block;
71
70
  }
72
71
  .mainpagearea{
73
72
  background-color: rgb(205, 205, 205);