Skip to content

Commit 08b9c94

Browse files
can pass user props
2 parents 5374439 + 749816c commit 08b9c94

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/utils/componentRender.util.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ const componentRender = (component, data) => {
3838
return `
3939
import React, { Component } from 'react';
4040
${childrenArray
41+
.filter(child => child.childType !== 'HTML')
4142
.map(child => `import ${child.componentName} from './${child.componentName}.tsx'`)
4243
.reduce((acc, child) => {
4344
if (!acc.includes(child)) {
@@ -66,7 +67,6 @@ const componentRender = (component, data) => {
6667
export default ${title};
6768
`;
6869
}
69-
7070
return `
7171
import React from 'react';
7272
${childrenArray
@@ -81,9 +81,8 @@ const componentRender = (component, data) => {
8181
}, [])
8282
.join('\n')}
8383
84-
8584
type Props = {
86-
${props.map(p => `${p.key}: ${p.type}`).join('\n')}
85+
${props.map(prop => `${prop.key}: ${typeSwitcher(prop.type)}`).join('\n')}
8786
}
8887
8988
const ${title} = (props: Props) => (

0 commit comments

Comments
 (0)