tee3apps-cms-sdk-react 0.0.19 → 0.0.22
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/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/Page.tsx +2 -2
- package/src/PageComponents/BoxComponent.tsx +142 -92
- package/src/PageComponents/Visual-Components/CarouselComponent.tsx +497 -364
- package/src/PageComponents/Visual-Components/GroupBrandComponent.tsx +396 -390
- package/src/PageComponents/Visual-Components/GroupCategoryComponent.tsx +21 -13
- package/src/PageComponents/Visual-Components/GroupImageList.tsx +642 -668
- package/src/PageComponents/Visual-Components/GroupProductComponent.tsx +46 -20
- package/src/PageComponents/Visual-Components/GroupVideoList.tsx +693 -589
- package/src/PageComponents/Visual-Components/ImageComponent.tsx +72 -17
- package/src/PageComponents/Visual-Components/LottieComponent.tsx +14 -8
- package/src/PageComponents/Visual-Components/NavigationComponent.tsx +74 -27
- package/src/PageComponents/Visual-Components/RichTextComponent.tsx +1 -1
- package/src/PageComponents/Visual-Components/TabComponent.tsx +1625 -875
- package/src/PageComponents/Visual-Components/TextComponent.tsx +24 -10
- package/src/PageComponents/Visual-Components/VideoComponent.tsx +33 -11
- package/src/PageComponents/Visual-Components/tab.css +645 -611
- package/src/index.css +126 -80
- package/src/Components/BoxRenderer.tsx +0 -108
- package/src/Components/ComponentRenderer.tsx +0 -29
- package/src/Components/ImageComponent.tsx +0 -68
- package/src/Components/RowComponent.tsx +0 -66
- package/src/Components/TextComponent.tsx +0 -47
|
@@ -2,11 +2,21 @@ import React from 'react';
|
|
|
2
2
|
import type { ComponentProps } from '../../types';
|
|
3
3
|
|
|
4
4
|
const TextComponent: React.FC<{ props: ComponentProps }> = ({ props }) => {
|
|
5
|
-
const { text, style } = props;
|
|
5
|
+
const { text, style, linktype, link, product, page, height, mode } = props;
|
|
6
|
+
|
|
7
|
+
// Extract text content - handle both old and new structure
|
|
8
|
+
const textContent = typeof text === 'string' ? text : text?.all || '';
|
|
6
9
|
|
|
7
10
|
const tagName = style?.headingTag ?? 'p';
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
// Get current device mode (default to web)
|
|
13
|
+
const currentMode = mode?.web || {};
|
|
14
|
+
|
|
15
|
+
// Check if currentMode has height and width properties (ImageModeProps)
|
|
16
|
+
const hasDimensions = 'height' in currentMode && 'width' in currentMode;
|
|
17
|
+
|
|
18
|
+
// Get text alignment, default to 'left' if not specified
|
|
19
|
+
const textAlignment: React.CSSProperties['textAlign'] = (style?.textAlign as React.CSSProperties['textAlign']) || 'left';
|
|
10
20
|
|
|
11
21
|
const textStyle = {
|
|
12
22
|
fontSize: style?.fontSize ? `${style.fontSize}px` : '16px',
|
|
@@ -15,16 +25,19 @@ const TextComponent: React.FC<{ props: ComponentProps }> = ({ props }) => {
|
|
|
15
25
|
textDecoration: style?.fontStyle?.isUnderLine ? 'underline' : 'none',
|
|
16
26
|
textDecorationLine: style?.fontStyle?.isStrikeThrough ? 'line-through' : 'none',
|
|
17
27
|
color: style?.fontColor || '#000',
|
|
18
|
-
textAlign:
|
|
28
|
+
textAlign: textAlignment,
|
|
19
29
|
fontFamily: style?.fontFamily || 'inherit',
|
|
20
|
-
|
|
30
|
+
height: height || (hasDimensions ? currentMode.height : 'auto'),
|
|
31
|
+
width: hasDimensions ? currentMode.width : '100%',
|
|
32
|
+
margin: 0,
|
|
33
|
+
// padding: 0,
|
|
21
34
|
wordWrap: "break-word",
|
|
22
35
|
overflowWrap: "break-word",
|
|
23
36
|
maxWidth: "100%",
|
|
24
37
|
whiteSpace: "normal",
|
|
25
|
-
width: "100%",
|
|
26
38
|
boxSizing: "border-box",
|
|
27
39
|
wordBreak: "break-word",
|
|
40
|
+
padding: '5px',
|
|
28
41
|
};
|
|
29
42
|
|
|
30
43
|
// ✅ Build the dynamic link URL
|
|
@@ -44,8 +57,8 @@ const TextComponent: React.FC<{ props: ComponentProps }> = ({ props }) => {
|
|
|
44
57
|
if (!code) return null;
|
|
45
58
|
|
|
46
59
|
return pdType === 'VARIANT'
|
|
47
|
-
?
|
|
48
|
-
:
|
|
60
|
+
? `/${code}`
|
|
61
|
+
: `/model/${code}`;
|
|
49
62
|
case 'TAG':
|
|
50
63
|
return `/tag/${linkData.tag?.code}`;
|
|
51
64
|
case 'PAGE':
|
|
@@ -60,7 +73,7 @@ const TextComponent: React.FC<{ props: ComponentProps }> = ({ props }) => {
|
|
|
60
73
|
const textElement = React.createElement(
|
|
61
74
|
tagName,
|
|
62
75
|
{ style: textStyle },
|
|
63
|
-
|
|
76
|
+
textContent
|
|
64
77
|
);
|
|
65
78
|
|
|
66
79
|
// ✅ Wrap text in anchor tag if link is present
|
|
@@ -73,13 +86,14 @@ const TextComponent: React.FC<{ props: ComponentProps }> = ({ props }) => {
|
|
|
73
86
|
wordWrap: "break-word",
|
|
74
87
|
overflowWrap: "break-word",
|
|
75
88
|
boxSizing: "border-box",
|
|
89
|
+
textAlign: textAlignment,
|
|
76
90
|
}}>
|
|
77
91
|
<a
|
|
78
92
|
href={url}
|
|
79
93
|
target={props?.linktype=='EXTERNAL' ? props?.link?.target :'_self'}
|
|
80
94
|
style={{
|
|
81
95
|
textDecoration: 'none',
|
|
82
|
-
display: "
|
|
96
|
+
display: "block",
|
|
83
97
|
width: "100%",
|
|
84
98
|
maxWidth: "100%",
|
|
85
99
|
boxSizing: "border-box",
|
|
@@ -104,7 +118,7 @@ const TextComponent: React.FC<{ props: ComponentProps }> = ({ props }) => {
|
|
|
104
118
|
wordWrap: "break-word",
|
|
105
119
|
overflowWrap: "break-word",
|
|
106
120
|
boxSizing: "border-box",
|
|
107
|
-
|
|
121
|
+
textAlign: textAlignment,
|
|
108
122
|
}}>
|
|
109
123
|
{textElement}
|
|
110
124
|
</div>
|
|
@@ -90,28 +90,50 @@ const VideoComponent: React.FC<VideoComponentMainProps> = ({
|
|
|
90
90
|
const getCurrentMode = () => {
|
|
91
91
|
switch (deviceMode) {
|
|
92
92
|
case 'mobileweb':
|
|
93
|
-
return props.mode
|
|
93
|
+
return props.mode?.mobileweb;
|
|
94
94
|
case 'mobileapp':
|
|
95
|
-
return props.mode
|
|
95
|
+
return props.mode?.mobileapp;
|
|
96
96
|
case 'tablet':
|
|
97
|
-
return props.mode
|
|
97
|
+
return props.mode?.tablet;
|
|
98
98
|
case 'web':
|
|
99
99
|
default:
|
|
100
|
-
return props.mode
|
|
100
|
+
return props.mode?.web;
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
103
|
|
|
104
104
|
const currentMode = getCurrentMode();
|
|
105
105
|
const video = props.videos;
|
|
106
106
|
|
|
107
|
-
|
|
107
|
+
// Don't render if no video data is available
|
|
108
|
+
if (!video || !video.url || video.url === '') {
|
|
109
|
+
return (
|
|
110
|
+
<div
|
|
111
|
+
className="image-box"
|
|
112
|
+
style={{
|
|
113
|
+
borderRadius: `${currentMode?.borderRadius ?? 0}px`,
|
|
114
|
+
height: boxHeight,
|
|
115
|
+
overflow: 'hidden',
|
|
116
|
+
display: 'flex',
|
|
117
|
+
alignItems: 'center',
|
|
118
|
+
justifyContent: 'center',
|
|
119
|
+
backgroundColor: '#f0f0f0',
|
|
120
|
+
color: '#999',
|
|
121
|
+
fontSize: '14px'
|
|
122
|
+
}}
|
|
123
|
+
>
|
|
124
|
+
No video available
|
|
125
|
+
</div>
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const containerHeight = boxHeight;
|
|
108
130
|
|
|
109
131
|
const renderPlayer = () => {
|
|
110
132
|
const commonStyle: React.CSSProperties = {
|
|
111
133
|
width: '100%',
|
|
112
134
|
height: '100%',
|
|
113
135
|
border: 0,
|
|
114
|
-
borderRadius: `${currentMode
|
|
136
|
+
borderRadius: `${currentMode?.borderRadius ?? 0}px`,
|
|
115
137
|
objectFit: 'contain',
|
|
116
138
|
};
|
|
117
139
|
|
|
@@ -120,7 +142,7 @@ const VideoComponent: React.FC<VideoComponentMainProps> = ({
|
|
|
120
142
|
const src = id ? `https://www.youtube.com/embed/${id}` : video.url;
|
|
121
143
|
return (
|
|
122
144
|
<iframe
|
|
123
|
-
title={video.alt
|
|
145
|
+
title={video.alt ?? 'YouTube video'}
|
|
124
146
|
src={src}
|
|
125
147
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
|
126
148
|
allowFullScreen
|
|
@@ -134,7 +156,7 @@ const VideoComponent: React.FC<VideoComponentMainProps> = ({
|
|
|
134
156
|
const src = id ? `https://player.vimeo.com/video/${id}` : video.url;
|
|
135
157
|
return (
|
|
136
158
|
<iframe
|
|
137
|
-
title={video.alt
|
|
159
|
+
title={video.alt ?? 'Vimeo video'}
|
|
138
160
|
src={src}
|
|
139
161
|
allow="autoplay; fullscreen; picture-in-picture"
|
|
140
162
|
allowFullScreen
|
|
@@ -148,7 +170,7 @@ const VideoComponent: React.FC<VideoComponentMainProps> = ({
|
|
|
148
170
|
const src = id ? `https://www.dailymotion.com/embed/video/${id}` : video.url;
|
|
149
171
|
return (
|
|
150
172
|
<iframe
|
|
151
|
-
title={video.alt
|
|
173
|
+
title={video.alt ?? 'Dailymotion video'}
|
|
152
174
|
src={src}
|
|
153
175
|
allow="autoplay; fullscreen; picture-in-picture"
|
|
154
176
|
allowFullScreen
|
|
@@ -165,7 +187,7 @@ const VideoComponent: React.FC<VideoComponentMainProps> = ({
|
|
|
165
187
|
playsInline
|
|
166
188
|
controls={video.controls !== false}
|
|
167
189
|
loop={video.loop === true}
|
|
168
|
-
style={{ width: '100%', height: '100%', borderRadius: `${currentMode
|
|
190
|
+
style={{ width: '100%', height: '100%', borderRadius: `${currentMode?.borderRadius ?? 0}px` }}
|
|
169
191
|
poster={typeof video.thumbnail === 'string' ? video.thumbnail : undefined}
|
|
170
192
|
>
|
|
171
193
|
<source src={`${Linodeurl}${video.url}`} />
|
|
@@ -177,7 +199,7 @@ const VideoComponent: React.FC<VideoComponentMainProps> = ({
|
|
|
177
199
|
<div
|
|
178
200
|
className="image-box"
|
|
179
201
|
style={{
|
|
180
|
-
borderRadius: `${currentMode
|
|
202
|
+
borderRadius: `${currentMode?.borderRadius ?? 0}px`,
|
|
181
203
|
height: containerHeight,
|
|
182
204
|
objectFit: 'contain',
|
|
183
205
|
|