Skip to content

Commit b5e0e9a

Browse files
committed
initial commit
1 parent 57d49d3 commit b5e0e9a

File tree

2 files changed

+53
-54
lines changed

2 files changed

+53
-54
lines changed

src/components/right-sidebar/CodeSnippet.vue

Lines changed: 45 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,8 @@ Description:
1212
Select a component
1313
</div>
1414
<div v-else>{{ `${this.activeComponent}.vue` }}</div>
15-
<prism-editor
16-
v-model="code"
17-
:highlight="highlighter"
18-
line-numbers
19-
class="my-editor"
20-
readonly
21-
/>
22-
</div>
15+
<prism-editor v-model="code" :highlight="highlighter" line-numbers class="my-editor" readonly />
16+
</div>
2317
</template>
2418

2519
<script>
@@ -48,14 +42,14 @@ export default {
4842
...mapState(["componentMap", "activeComponent", "activeComponentObj", "exportAsTypescript"]),
4943
},
5044
methods: {
51-
snippetInvoke(){
52-
if (this.activeComponent !== ''){
45+
snippetInvoke() {
46+
if (this.activeComponent !== '') {
5347
this.code = this.createCodeSnippet(
5448
this.componentMap[this.activeComponent].componentName,
5549
this.componentMap[this.activeComponent].children
5650
)
57-
} else {
58-
this.code = 'Your component boilerplate will be displayed here.'
51+
} else {
52+
this.code = 'Your component boilerplate will be displayed here.'
5953
}
6054
},
6155
//highlighter does not work: OverVue 6.0;
@@ -95,30 +89,30 @@ export default {
9589
"list-ul": ["<ul", "</ul>"],
9690
input: ["<input", ""], //single
9791
navbar: ["<nav", "</nav>"],
98-
header:["<header","</header>"],
99-
footer:["<footer", "</footer>"],
92+
header: ["<header", "</header>"],
93+
footer: ["<footer", "</footer>"],
10094
meta: ["<meta", "</meta>"],
101-
h1:["<h1", "</h1>"],
102-
h2:["<h2", "</h2>"],
103-
h3:["<h3", "</h3>"],
104-
h4:["<h4", "</h4>"],
105-
h5:["<h5", "</h5>"],
106-
h6:["<h6", "</h6>"],
95+
h1: ["<h1", "</h1>"],
96+
h2: ["<h2", "</h2>"],
97+
h3: ["<h3", "</h3>"],
98+
h4: ["<h4", "</h4>"],
99+
h5: ["<h5", "</h5>"],
100+
h6: ["<h6", "</h6>"],
107101
};
108-
//test//
109-
// function writeClass(componentName) {
110-
// if (this.componentMap[componentName]?.classList?.length > 0) {
111-
// let commentStr = '<!--'
112-
// this.componentMap[componentName].classList.forEach((el) => {
113-
// commentStr += "\n"
114-
// commentStr += el;
115-
// })
116-
// commentStr += '\n-->\n\n'
117-
// return commentStr;
118-
// } else {
119-
// return ''
120-
// }
121-
// };
102+
//test//
103+
// function writeClass(componentName) {
104+
// if (this.componentMap[componentName]?.classList?.length > 0) {
105+
// let commentStr = '<!--'
106+
// this.componentMap[componentName].classList.forEach((el) => {
107+
// commentStr += "\n"
108+
// commentStr += el;
109+
// })
110+
// commentStr += '\n-->\n\n'
111+
// return commentStr;
112+
// } else {
113+
// return ''
114+
// }
115+
// };
122116
// Helper function that recursively iterates through the given html element's children and their children's children.
123117
// also adds proper indentation to code snippet
124118
function writeNested(childrenArray, indent) {
@@ -134,13 +128,13 @@ export default {
134128
nestedString += `<${child}/>\n`;
135129
} else {
136130
nestedString += htmlElementMap[child.text][0];
137-
if(child.class !== "") {
138-
nestedString += " " + "class = " + `"${el.class}"`;
139-
}
140-
if(child.text === "img" || child.text === "input" || child.text === "link") {
141-
nestedString += "/>";
142-
} else {nestedString += ">";}
143-
131+
if (child.class !== "") {
132+
nestedString += " " + "class = " + `"${el.class}"`;
133+
}
134+
if (child.text === "img" || child.text === "input" || child.text === "link") {
135+
nestedString += "/>";
136+
} else { nestedString += ">"; }
137+
144138
if (child.children.length) {
145139
nestedString += "\n";
146140
nestedString += writeNested(child.children, indented);
@@ -156,22 +150,19 @@ export default {
156150
157151
// Iterates through active component's HTML elements list and adds to code snippet
158152
let htmlArr = this.componentMap[componentName].htmlList;
159-
console.log("ALERT")
160-
console.log(htmlArr[0].class)
161-
console.log(htmlArr[0].children)
162153
let outputStr = ``;
163154
// eslint-disable-next-line no-unused-vars
164155
for (let el of htmlArr) {
165156
if (!el.text) {
166157
outputStr += ` <${el}/>\n`;
167158
} else {
168159
outputStr += ` `;
169-
outputStr += htmlElementMap[el.text][0]
170-
//if conditional to check class
171-
if(el.class !== "") {
172-
outputStr += " " + "class = " + `"${el.class}"`;
173-
}
174-
outputStr += ">";
160+
outputStr += htmlElementMap[el.text][0]
161+
//if conditional to check class
162+
if (el.class !== "") {
163+
outputStr += " " + "class = " + `"${el.class}"`;
164+
}
165+
outputStr += ">";
175166
if (el.children.length) {
176167
outputStr += "\n";
177168
outputStr += writeNested(el.children, ` `);
@@ -204,7 +195,7 @@ export default {
204195
imports += ' } from "vuex";\n';
205196
}
206197
207-
// if Typescript toggle is on, import defineComponent
198+
// if Typescript toggle is on, import defineComponent
208199
if (this.exportAsTypescript === "on") {
209200
imports += 'import { defineComponent } from "vue";\n';
210201
}
@@ -285,19 +276,19 @@ export default {
285276
// watches activeComponentObj for changes to make it reactive upon mutation
286277
// // // watches componentMap for changes to make it reactive upon mutation
287278
activeComponent: {
288-
handler () {
279+
handler() {
289280
this.snippetInvoke();
290281
},
291282
deep: true
292283
},
293284
componentMap: {
294-
handler () {
285+
handler() {
295286
this.snippetInvoke();
296287
},
297288
deep: true
298289
},
299290
exportAsTypescript: {
300-
handler () {
291+
handler() {
301292
this.snippetInvoke();
302293
},
303294
}

src/components/right-sidebar/HTMLQueue.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,14 @@ export default {
160160
this.addActiveComponentClass(payload);
161161
this.classText = '';
162162
},
163+
// submitBinding(element, idNum) {
164+
// if (element === '') {
165+
// return;
166+
// }
167+
// let payload = {
168+
169+
// }
170+
// }
163171
},
164172
watch: {
165173
attributeModalOpen (){

0 commit comments

Comments
 (0)