Skip to content

Commit 3319386

Browse files
committed
completed adding style in code snippet
1 parent f95d7b9 commit 3319386

File tree

1 file changed

+28
-14
lines changed

1 file changed

+28
-14
lines changed

src/components/right-sidebar/CodeSnippet.vue

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,12 @@ export default {
137137
// Iterates through active component's HTML elements list and adds to code snippet
138138
let htmlArr = this.componentMap[componentName].htmlList;
139139
console.log("ALERT")
140-
console.log(htmlArr[0].class)
141-
console.log(htmlArr[0].children)
140+
console.log('hellloo')
141+
console.log("here", htmlArr[0].class)
142+
console.log(htmlArr[0].children);
142143
let outputStr = ``;
143144
// eslint-disable-next-line no-unused-vars
144-
for (let el of htmlArr) {
145+
for (const el of htmlArr) {
145146
if (!el.text) {
146147
outputStr += ` <${el}/>\n`;
147148
} else {
@@ -235,19 +236,32 @@ export default {
235236
methods += "\n ]),\n";
236237
methods += " },\n";
237238
}
238-
//creating a styleString too add to style scoped style
239-
let classArr = this.componentMap[componentName].htmlList;
240-
console.log('thisone', classArr);
241-
const styleStr = ' ';
242-
for (const hmtl of classArr) {
243-
if (!html.text) return;
239+
//creating a styleString too add to style scope1d style
240+
// let classArr = this.componentMap[componentName].htmlList;
241+
// console.log('thisone', classArr[0].class);
242+
// const styleStr = ' ';
243+
// for (const htmlKey of classArr) {
244+
// if (!htmlKey.text) return;
245+
// if (htmlKey.class) {
246+
// styleStr += `.${htmlKey.class}{\n}`
247+
// }
248+
// //left off here: think there is an issue to render this information::::::::
249+
// return styleStr;
250+
// }
251+
252+
let htmlArray = this.componentMap[componentName].htmlList;
253+
console.log("down here", htmlArray);
254+
let styleString = "";
255+
for (const html of htmlArray) {
256+
if (!html.class) styleString = "";
244257
if (html.class) {
245-
styleStr += `.${html.class}{\n}`
258+
styleString += `.${html.class} {\n}\n`
246259
}
247-
//left off here: think there is an issue to render this information::::::::
248-
return styleStr;
249260
}
250-
261+
// const accessProxy = new Proxy(htmlArray, getHandler)
262+
// const getHandler = {
263+
// get: function (htmlArray, )
264+
// };
251265
252266
// concat all code within script tags
253267
// if exportAsTypescript is on, out should be <script lang="ts">
@@ -269,7 +283,7 @@ export default {
269283
output += "});\n<\/script>\n\n<style scoped>\n</style>"
270284
271285
} else {
272-
output += `};\n<\/script>\n\n<style scoped>\n${styleStr}</style>`
286+
output += `}; \n <\/script>\n\n<style scoped>\n${styleString}</style > `
273287
}
274288
return output
275289
},

0 commit comments

Comments
 (0)