Skip to content

Commit 72e88f6

Browse files
committed
multiple pages done
1 parent b8dfeee commit 72e88f6

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

app/src/components/main/AddLink.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ function AddLink({ id }: AddRoutes) {
2424
const handlePageSelect = event => {
2525
const selectedPageName = event.target.value;
2626
console.log('selectedPages State: ', selectedPageName);
27+
console.log('page state', state.components[0].children);
28+
state.components[0].children.forEach(element => {
29+
if(element.childId === id) {
30+
element.attributes.compLink = event.target.value;
31+
}
32+
});
33+
// selectedPageName.compLink = event.target.value;
2734
// dispatch({ type: 'HREF TO', payload: });
2835
}
2936

app/src/components/main/DemoRender.tsx

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -78,24 +78,12 @@ const DemoRender = (): JSX.Element => {
7878
};
7979

8080
let code = '';
81-
//compone
82-
83-
componentBuilder(state.components[0].children).forEach((element, index) => {
84-
// if(element.props.component === 'Link') {
85-
// return;
86-
// // element.props.component = 'a';
87-
// // element.props.id = `rend${6}`;
88-
// } else if(typeof element.type === 'function') {
89-
// return;
90-
// }
91-
console.log('element' + index, element);
92-
console.log('component' + index, state.components[0].children[index * 2 + 1]);
81+
const currComponent = state.components.filter(element => element.id === state.canvasFocus.componentId);
82+
componentBuilder(currComponent[0].children).forEach(element => {
9383
try{
9484
if(element.props.component === 'Link') {
9585

9686
}
97-
// element.props.component = 'a';
98-
// element.props.id = `rend${6}`;
9987
code += ReactDOMServer.renderToString(element)
10088
} catch {
10189
return;

0 commit comments

Comments
 (0)