@developer_tribe/react-builder 0.1.14 → 0.1.16

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.
@@ -12,15 +12,15 @@ export const mainNodeContext = createContext<{
12
12
  } | null>(null);
13
13
 
14
14
  export function RenderMainNode({
15
- node,
15
+ children,
16
16
  localication,
17
17
  defaultLanguage,
18
18
  theme,
19
19
  }: {
20
- node: Node;
21
20
  localication?: Localication;
22
21
  defaultLanguage?: string;
23
22
  theme?: 'light' | 'dark';
23
+ children: React.ReactNode;
24
24
  warning?: string;
25
25
  setWarning?: (message: string) => void;
26
26
  }) {
@@ -31,7 +31,7 @@ export function RenderMainNode({
31
31
  value={{ localication, defaultLanguage, theme, warning, setWarning }}
32
32
  >
33
33
  {warning && <div className="warning">{warning}</div>}
34
- <RenderNode node={node} />
34
+ {children}
35
35
  </mainNodeContext.Provider>
36
36
  );
37
37
  }
@@ -2,6 +2,7 @@ import { Localication } from './types/PreviewConfig';
2
2
  import { TargetedScreenSize } from './types/TargetedScreenSize';
3
3
  import { RenderMainNode } from './RenderMainNode';
4
4
  import { Node } from './types/Node';
5
+ import { RenderNode } from './build-components';
5
6
  type RenderPageProps = {
6
7
  data: Node;
7
8
  screenSize: TargetedScreenSize;
@@ -50,10 +51,11 @@ export function RenderPage({
50
51
  {
51
52
  <RenderMainNode
52
53
  localication={localication}
53
- node={data}
54
54
  defaultLanguage={defaultLanguage}
55
55
  theme={theme}
56
- />
56
+ >
57
+ <RenderNode node={data} />
58
+ </RenderMainNode>
57
59
  }
58
60
  </div>
59
61
  </div>
@@ -26,3 +26,16 @@ export function getSamples(): Project[] {
26
26
  ...legacySamples,
27
27
  ];
28
28
  }
29
+
30
+ export function getBasicSamples(): Project[] {
31
+ return [simple1 as Project, simple2 as Project, carouselSample as Project];
32
+ }
33
+
34
+ export function getOnboardSamples(): Project[] {
35
+ return [
36
+ vpnOnboard1 as Project,
37
+ vpnOnboard2 as Project,
38
+ vpnOnboard3 as Project,
39
+ vpnOnboard4 as Project,
40
+ ];
41
+ }
@@ -13,9 +13,6 @@ function OnboardProvider({ node }: OnboardProviderComponentProps) {
13
13
  const [selectedIndex, setSelectedIndex] = useState(0);
14
14
 
15
15
  const children = useMemo(() => {
16
- console.log('node', node);
17
- console.log('node.children', node.children);
18
-
19
16
  const onboardChild: NodeData = (node.children as NodeData[]).filter(
20
17
  (c) => c.type === 'Onboard',
21
18
  )[0];
package/src/index.ts CHANGED
@@ -12,6 +12,8 @@ export {
12
12
  analyseNode,
13
13
  } from './utils/analyseNode';
14
14
  export { getSamples } from './assets/samples/getSamples';
15
+ export { getBasicSamples } from './assets/samples/getSamples';
16
+ export { getOnboardSamples } from './assets/samples/getSamples';
15
17
  export { PreviewConfig } from './types/PreviewConfig';
16
18
  export { RenderPage } from './RenderPage';
17
19
  export { RenderMainNode } from './RenderMainNode';
@@ -246,7 +246,7 @@ function mapFooterFromGeneralComponents(generalComponents: any[]): Node | null {
246
246
  if (children.length === 0) return null;
247
247
 
248
248
  return {
249
- type: 'view',
249
+ type: 'OnboardFooter',
250
250
  attributes: { gap: 8 },
251
251
  children,
252
252
  } as NodeData;