Skip to content

Commit a7d25d3

Browse files
committed
it renders huzzah
1 parent 18612de commit a7d25d3

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

app/src/components/main/DemoRender.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@ import ReactDOMServer from 'react-dom/server';
1212
// real react components that utilize hot module reloading to depict the user's prototype application.
1313
const DemoRender = (): JSX.Element => {
1414
const [state,] = useContext(StateContext);
15-
console.log('state line 14', state);
1615
let currentComponent = state.components.find(
1716
(elem: Component) => elem.id === state.canvasFocus.componentId
1817
);
19-
20-
console.log('currentComponent.code', currentComponent.code);
18+
2119
// Create React ref to inject transpiled code in inframe
2220
const iframe = useRef<any>();
2321
const demoContainerStyle = {
@@ -50,8 +48,8 @@ const DemoRender = (): JSX.Element => {
5048
</html>
5149
`;
5250

53-
// This function is the heart of DemoRender it will take the array of components stored in state and dynamically construct the desired React component for the live demo
54-
// Material UI is utilized to incorporate the apporpriate tags with specific configuration designs as necessitated by HTML standards.
51+
// This function is the heart of DemoRender it will take the array of components stored in state and dynamically construct the desired React component for the live demo
52+
// Material UI is utilized to incorporate the apporpriate tags with specific configuration designs as necessitated by HTML standards.
5553
const componentBuilder = (array: object, key: number = 0) => {
5654
const componentsToRender = [];
5755
for (const element of array) {
@@ -78,23 +76,23 @@ const DemoRender = (): JSX.Element => {
7876
}
7977
return componentsToRender;
8078
};
81-
79+
8280
let code = '';
81+
//compone
8382
componentBuilder(state.components[0].children).forEach(element => code += ReactDOMServer.renderToString(element));
8483

8584
useEffect(() => {
8685
cssRefresher();
8786
}, [])
8887

8988
useEffect(() => {
90-
console.log('code', code);
9189
iframe.current.contentWindow.postMessage(code, '*');
9290
}, [code])
9391

9492
return (
95-
<div id={'renderFocus'} style={demoContainerStyle}>
96-
<iframe ref={iframe} sandbox='allow-scripts' srcDoc={html} width='100%' height='100%'/>
97-
</div>
93+
<div id={'renderFocus'} style={demoContainerStyle}>
94+
<iframe ref={iframe} sandbox='allow-scripts' srcDoc={html} width='100%' height='100%' />
95+
</div>
9896
);
9997
};
10098

0 commit comments

Comments
 (0)