@@ -88,35 +88,35 @@ const createCodeSnippet = (componentName, children) => {
8888// Creates beginner boilerplate
8989const createTemplate = (componentName ) => {
9090 let templateTagStr = writeTemplateTag (componentName, activeComponent .value ); // testing 2nd arg
91+ let routeStr = " " ;
92+ const arrOfChildComp = componentMap .value [componentName].children ;
93+ arrOfChildComp .forEach ((childName ) => {
94+ let childNameClass = componentMap .value [childName].htmlAttributes .class ;
95+ let childNameClassFullStr =
96+ childNameClass === " " ? " " : ` class = '${ childNameClass} '` ;
97+ routeStr += ` <${ childName}${ childNameClassFullStr} ></${ childName} >\n ` ;
98+ });
9199 if (activeComponentObj .value .htmlAttributes ) {
92100 // if/else statement to determine if there are class and id attributes present in the html element
93101 if (
94102 activeComponentObj .value .htmlAttributes .class !== " " &&
95103 activeComponentObj .value .htmlAttributes .id !== " "
96104 ) {
97- return ` <template>\n <div id = "${ activeComponentObj .value .htmlAttributes .id } " class = "${ activeComponentObj .value .htmlAttributes .class } ">\n ${ templateTagStr} </div>\n </template>` ;
105+ return ` <template>\n <div id = "${ activeComponentObj .value .htmlAttributes .id } " class = "${ activeComponentObj .value .htmlAttributes .class } ">\n ${ templateTagStr}${ routeStr } </div>\n </template>` ;
98106 } else if (
99107 activeComponentObj .value .htmlAttributes .class !== " " &&
100108 activeComponentObj .value .htmlAttributes .id === " "
101109 ) {
102- return ` <template>\n <div class = "${ activeComponentObj .value .htmlAttributes .class } ">\n ${ templateTagStr} </div>\n </template>` ;
110+ return ` <template>\n <div class = "${ activeComponentObj .value .htmlAttributes .class } ">\n ${ templateTagStr}${ routeStr } </div>\n </template>` ;
103111 } else if (
104112 activeComponentObj .value .htmlAttributes .class === " " &&
105113 activeComponentObj .value .htmlAttributes .id !== " "
106114 )
107- return ` <template>\n <div id = "${ activeComponentObj .value .htmlAttributes .id } ">\n ${ templateTagStr} </div>\n </template>` ;
115+ return ` <template>\n <div id = "${ activeComponentObj .value .htmlAttributes .id } ">\n ${ templateTagStr}${ routeStr } </div>\n </template>` ;
108116 else {
109- let routeStr = " " ;
110- const arrOfChildComp = componentMap .value [componentName].children ;
111- arrOfChildComp .forEach ((childName ) => {
112- let childNameClass = componentMap .value [childName].htmlAttributes .class ;
113- let childNameClassFullStr =
114- childNameClass === " " ? " " : ` class = '${ childNameClass} '` ;
115- routeStr += ` <${ childName}${ childNameClassFullStr} ></${ childName} >\n ` ;
116- });
117117 return ` <template>\n <div>\n ${ templateTagStr}${ routeStr} </div>\n </template>` ;
118118 }
119- } else return ` <template> \n <div> \n ${ templateTagStr } </div> \n </template> ` ;
119+ }
120120};
121121
122122// Creates <template> boilerplate
@@ -401,9 +401,9 @@ const createBoiler = (componentName, children) => {
401401 let styleString = " " ;
402402
403403 if (activeComponentObj .value .htmlAttributes .class !== " " ) {
404- styleString += ` .${ activeComponentObj .value .htmlAttributes .class } { \n background -color: ${ activeComponentObj .value .color } ;
405- grid -area: ${ activeComponentObj .value .htmlAttributes .gridArea [0 ]} / ${ activeComponentObj .value .htmlAttributes .gridArea [1 ]} / ${ activeComponentObj .value .htmlAttributes .gridArea [2 ]} / ${ activeComponentObj .value .htmlAttributes .gridArea [3 ]} ;
406- z -index: ${ activeComponentObj .value .z } ;
404+ styleString += ` .${ activeComponentObj .value .htmlAttributes .class } { \n\t background -color: ${ activeComponentObj .value .color } ;
405+ \t grid -area: ${ activeComponentObj .value .htmlAttributes .gridArea [0 ]} / ${ activeComponentObj .value .htmlAttributes .gridArea [1 ]} / ${ activeComponentObj .value .htmlAttributes .gridArea [2 ]} / ${ activeComponentObj .value .htmlAttributes .gridArea [3 ]} ;
406+ \t z -index: ${ activeComponentObj .value .z } ;
407407} \n ` ;
408408 }
409409
0 commit comments