@@ -88,35 +88,35 @@ const createCodeSnippet = (componentName, children) => {
88
88
// Creates beginner boilerplate
89
89
const createTemplate = (componentName ) => {
90
90
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
+ });
91
99
if (activeComponentObj .value .htmlAttributes ) {
92
100
// if/else statement to determine if there are class and id attributes present in the html element
93
101
if (
94
102
activeComponentObj .value .htmlAttributes .class !== " " &&
95
103
activeComponentObj .value .htmlAttributes .id !== " "
96
104
) {
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>` ;
98
106
} else if (
99
107
activeComponentObj .value .htmlAttributes .class !== " " &&
100
108
activeComponentObj .value .htmlAttributes .id === " "
101
109
) {
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>` ;
103
111
} else if (
104
112
activeComponentObj .value .htmlAttributes .class === " " &&
105
113
activeComponentObj .value .htmlAttributes .id !== " "
106
114
)
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>` ;
108
116
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
- });
117
117
return ` <template>\n <div>\n ${ templateTagStr}${ routeStr} </div>\n </template>` ;
118
118
}
119
- } else return ` <template> \n <div> \n ${ templateTagStr } </div> \n </template> ` ;
119
+ }
120
120
};
121
121
122
122
// Creates <template> boilerplate
@@ -401,9 +401,9 @@ const createBoiler = (componentName, children) => {
401
401
let styleString = " " ;
402
402
403
403
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 } ;
407
407
} \n ` ;
408
408
}
409
409
0 commit comments