Skip to content

Commit 825a375

Browse files
committed
added button and form to be nestable
1 parent 01a1145 commit 825a375

File tree

3 files changed

+47
-9
lines changed

3 files changed

+47
-9
lines changed

app/src/helperFunctions/generateCode.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ const generateUnformattedCode = (
7676
);
7777
child['tag'] = referencedHTML.tag;
7878
if (
79+
referencedHTML.tag === 'h1' ||
80+
referencedHTML.tag === 'h2' ||
81+
referencedHTML.tag === 'button' ||
82+
referencedHTML.tag === 'span' ||
7983
referencedHTML.tag === 'div' ||
8084
referencedHTML.tag === 'separator' ||
8185
referencedHTML.tag === 'form' ||
@@ -274,6 +278,7 @@ const generateUnformattedCode = (
274278
const nestable =
275279
childElement.tag === 'h1' ||
276280
childElement.tag === 'h2' ||
281+
childElement.tag === 'button' ||
277282
childElement.tag === 'p' ||
278283
childElement.tag === 'div' ||
279284
childElement.tag === 'form' ||

app/src/helperFunctions/renderChildren.tsx

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,13 @@ const renderChildren = (children: ChildElement[]) => {
3030
type={type}
3131
typeId={typeId}
3232
key={'DirChildComp' + childId.toString() + name}
33-
name={name} style={undefined} attributes={undefined} events={undefined} stateProps={[]} passedInProps={[]} />
33+
name={name}
34+
style={undefined}
35+
attributes={undefined}
36+
events={undefined}
37+
stateProps={[]}
38+
passedInProps={[]}
39+
/>
3440
);
3541
}
3642
// child is a non-nestable type of HTML element (aka NOT divs, forms, OrderedLists, UnorderedLists, menus)
@@ -41,6 +47,7 @@ const renderChildren = (children: ChildElement[]) => {
4147
typeId !== 2 &&
4248
typeId !== 3 &&
4349
typeId !== 4 &&
50+
typeId !== 5 &&
4451
typeId !== 6 &&
4552
typeId !== 8 &&
4653
typeId !== 9 &&
@@ -58,7 +65,13 @@ const renderChildren = (children: ChildElement[]) => {
5865
type={type}
5966
typeId={typeId}
6067
key={'DirChildHTML' + childId.toString() + name}
61-
name={name} style={undefined} attributes={undefined} events={undefined} stateProps={[]} passedInProps={[]} />
68+
name={name}
69+
style={undefined}
70+
attributes={undefined}
71+
events={undefined}
72+
stateProps={[]}
73+
passedInProps={[]}
74+
/>
6275
);
6376
}
6477
// child is a nestable type of HTML element (divs, forms, OrderedLists, UnorderedLists, menus)
@@ -68,6 +81,7 @@ const renderChildren = (children: ChildElement[]) => {
6881
typeId === 2 ||
6982
typeId === 3 ||
7083
typeId === 4 ||
84+
typeId === 5 ||
7185
typeId === 6 ||
7286
typeId === 8 ||
7387
typeId === 9 ||
@@ -96,7 +110,12 @@ const renderChildren = (children: ChildElement[]) => {
96110
children={children}
97111
key={'DirChildHTMLNest' + childId.toString() + name}
98112
name={name}
99-
attributes={attributes} style={undefined} events={undefined} stateProps={[]} passedInProps={[]} />
113+
attributes={attributes}
114+
style={undefined}
115+
events={undefined}
116+
stateProps={[]}
117+
passedInProps={[]}
118+
/>
100119
);
101120
} else if (type === 'HTML Element' && typeId === 1000) {
102121
return (
@@ -105,11 +124,19 @@ const renderChildren = (children: ChildElement[]) => {
105124
type={type}
106125
typeId={typeId}
107126
children={children}
108-
key={'SeparatorChild' +
127+
key={
128+
'SeparatorChild' +
109129
childId.toString() +
110130
name +
111-
(Math.random() * 1000).toString()}
112-
name={name} style={undefined} attributes={undefined} events={undefined} stateProps={[]} passedInProps={[]} />
131+
(Math.random() * 1000).toString()
132+
}
133+
name={name}
134+
style={undefined}
135+
attributes={undefined}
136+
events={undefined}
137+
stateProps={[]}
138+
passedInProps={[]}
139+
/>
113140
);
114141
}
115142
// A route link is a next.js or gatsby.js navigation link
@@ -122,7 +149,13 @@ const renderChildren = (children: ChildElement[]) => {
122149
typeId={typeId}
123150
children={children}
124151
key={'RouteLink' + childId.toString() + name}
125-
name={name} style={undefined} attributes={undefined} events={undefined} stateProps={[]} passedInProps={[]} />
152+
name={name}
153+
style={undefined}
154+
attributes={undefined}
155+
events={undefined}
156+
stateProps={[]}
157+
passedInProps={[]}
158+
/>
126159
);
127160
}
128161
});

app/src/redux/HTMLTypes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const HTMLTypes: HTMLType[] = [
5959
placeHolderLong: '',
6060
icon: 'TextFormat',
6161
framework: 'reactClassic',
62-
nestable: TroubleshootSharp
62+
nestable: true
6363
},
6464
{
6565
id: 6,
@@ -114,7 +114,7 @@ const HTMLTypes: HTMLType[] = [
114114
placeHolderLong: '',
115115
icon: 'EditAttributes',
116116
framework: 'reactClassic',
117-
nestable: false
117+
nestable: true
118118
},
119119

120120
{

0 commit comments

Comments
 (0)