Skip to content

Commit 9b87d92

Browse files
Added switch component
1 parent f5463b5 commit 9b87d92

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

app/src/components/left/HTMLItem.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,11 @@ const HTMLItem : React.FC<{
122122
// updated the id's to reflect the new element types input and label
123123
return ( // HTML Elements
124124
<Grid item xs={5} key={`html-g${name}`}>
125-
{ id <= 16 &&
125+
{ id <= 17 &&
126126
<div ref={drag} className={isThemeLight ? `${classes.HTMLPanelItem} ${classes.lightThemeFontColor}` : `${classes.HTMLPanelItem} ${classes.darkThemeFontColor}`} id="HTMLItem">
127127
<h3>{name}</h3>
128128
</div>}
129-
{id > 16 &&
129+
{id > 17 &&
130130
<span id="customHTMLElement">
131131
<div ref={drag} className={isThemeLight ? `${classes.HTMLPanelItem} ${classes.lightThemeFontColor}` : `${classes.HTMLPanelItem} ${classes.darkThemeFontColor}`} id="HTMLItem">
132132
<h3>{name}</h3>

app/src/context/HTMLTypes.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,15 @@ const HTMLTypes: HTMLType[] = [
155155
placeHolderShort: 'list item',
156156
placeHolderLong: '',
157157
icon: ListIcon
158+
},
159+
{
160+
id: 17,
161+
tag: 'switch',
162+
name: 'Switch',
163+
style: {},
164+
placeHolderShort: 'switch item',
165+
placeHolderLong: '',
166+
icon: ListIcon
158167
}
159168
];
160169

app/src/helperFunctions/generateCode.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ const generateUnformattedCode = (
120120
childElement.tag === 'ol' ||
121121
childElement.tag === 'ul' ||
122122
childElement.tag === 'menu' ||
123-
childElement.tag === 'li';
123+
childElement.tag === 'li' ||
124+
childElement.tag === 'switch';
124125

125126
if (childElement.tag === 'img') {
126127
return `${levelSpacer(level, 5)}<${childElement.tag} src="${activeLink}" ${elementTagDetails(childElement)}/>${levelSpacer(2, (3 + level))}`;

app/src/helperFunctions/renderChildren.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const renderChildren = (children: ChildElement[]) => {
3434
}
3535
// ommitted orderedlists, unorderedlists, and menus, ommitted li items as non-nestable types because they can be nested within.
3636
// child is a non-nestable type of HTML element (everything except for divs and forms)
37-
else if (type === 'HTML Element' && typeId !== 11 && typeId !== 1000 && typeId !== 2 && typeId !== 3 && typeId !== 14 && typeId !== 15 && typeId !== 16) {
37+
else if (type === 'HTML Element' && typeId !== 11 && typeId !== 1000 && typeId !== 2 && typeId !== 3 && typeId !== 14 && typeId !== 15 && typeId !== 16 && typeId != 17) {
3838
return (
3939
<DirectChildHTML
4040
childId={childId}
@@ -48,7 +48,7 @@ const renderChildren = (children: ChildElement[]) => {
4848
}
4949
// Added Orderedlists, Unorderedlists, and Menus, changed lists to nestable because they are nestable.
5050
// child is a nestable type of HTML element (divs and forms)
51-
else if (type === 'HTML Element' && (typeId === 11 || typeId === 2 || typeId === 3 || typeId === 14 || typeId === 15 || typeId === 16)) {
51+
else if (type === 'HTML Element' && (typeId === 11 || typeId === 2 || typeId === 3 || typeId === 14 || typeId === 15 || typeId === 16 || typeId === 17)) {
5252
return (
5353
<DirectChildHTMLNestable
5454
childId={childId}

0 commit comments

Comments
 (0)