tee3apps-cms-sdk-react 0.0.18 → 0.0.20

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tee3apps-cms-sdk-react",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "description": "Uses JSON to dynamically generate and render UI pages in a website",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
package/src/App.css CHANGED
@@ -22,16 +22,14 @@
22
22
  }
23
23
 
24
24
  .image-box {
25
-
26
- width: 100%;
27
- /* height: 280px; */
25
+ width: 100%;
28
26
  overflow: hidden;
29
- display: flex;
30
- align-items: center;
31
- justify-content: center;
27
+ display: block;
28
+ position: relative;
32
29
  }
33
30
 
34
31
  .fitted-image {
35
32
  width: 100%;
36
- height: 100%;
33
+ height: auto;
34
+ display: block;
37
35
  }
@@ -61,6 +61,59 @@ const RowComponent: React.FC<RowComponentProps> = ({
61
61
  return null;
62
62
  }
63
63
 
64
+ // Check if children contain image/video components for dynamic height
65
+ const hasMediaComponents = (): boolean => {
66
+ const checkChild = (child: React.ReactNode): boolean => {
67
+ if (!React.isValidElement(child)) return false;
68
+
69
+ const componentName = (child.type as any)?.name || (child.type as any)?.displayName;
70
+ const mediaComponents = [
71
+ 'ImageComponent',
72
+ 'CarouselComponent',
73
+ 'VideoComponent',
74
+ 'TabComponent',
75
+ 'GroupImageComponent',
76
+ 'GroupVideoComponent'
77
+ ];
78
+
79
+ if (componentName && mediaComponents.includes(componentName)) {
80
+ return true;
81
+ }
82
+
83
+ // Check nested children
84
+ if (child.props && typeof child.props === 'object' && 'children' in child.props) {
85
+ const children = (child.props as any).children;
86
+ if (children) {
87
+ const nestedChildren = React.Children.toArray(children);
88
+ return nestedChildren.some(checkChild);
89
+ }
90
+ }
91
+
92
+ return false;
93
+ };
94
+
95
+ return React.Children.toArray(children).some(checkChild);
96
+ };
97
+
98
+ // Check if we have media components
99
+ const hasMedia = hasMediaComponents();
100
+
101
+ // Get dynamic height based on media components
102
+ const getRowHeight = (): string | undefined => {
103
+ if (hasMedia) {
104
+ return 'auto';
105
+ }
106
+ return currentMode.height;
107
+ };
108
+
109
+ // Get dynamic minHeight based on media components
110
+ const getRowMinHeight = (): string | undefined => {
111
+ if (hasMedia) {
112
+ return undefined; // Remove minHeight constraint for media components
113
+ }
114
+ return props.minHeight;
115
+ };
116
+
64
117
  // Handle content justification with proper CSS values
65
118
  const getJustifyContent = (): React.CSSProperties['justifyContent'] => {
66
119
  const justifyMap: Record<string, React.CSSProperties['justifyContent']> = {
@@ -81,14 +134,14 @@ const getJustifyContent = (): React.CSSProperties['justifyContent'] => {
81
134
  return (
82
135
  <div
83
136
  style={{
84
- minHeight: props.minHeight,
137
+ minHeight: getRowMinHeight(),
85
138
  backgroundColor: props.bgColor,
86
139
  backgroundImage: props.bgImage ? `url(${props.bgImage})` : 'none',
87
140
  backgroundSize: props.bgsize,
88
141
  backgroundPosition: 'center',
89
142
  backgroundRepeat: 'no-repeat',
90
143
  width: currentMode.width || '100%',
91
- height: currentMode.height,
144
+ height: getRowHeight(),
92
145
  marginTop: currentMode.top,
93
146
  marginBottom: currentMode.bottom,
94
147
  marginLeft: currentMode.left,