Skip to content

Commit 6b1b210

Browse files
committed
merge conflicts
2 parents aec3a9a + 5584bb3 commit 6b1b210

File tree

4 files changed

+80
-8
lines changed

4 files changed

+80
-8
lines changed

src/components/Canvas.vue

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,8 @@ export default {
451451
activeComponentData: this.activeComponentData,
452452
}
453453
this.updateColor(payload)
454-
},
454+
this.refresh();
455+
},
455456
456457
// records component's initial size/position in case of resize
457458
recordInitialSize: function (e) {
@@ -478,8 +479,25 @@ export default {
478479
payload.h !== this.initialSize.h
479480
) {
480481
this.updateComponentSize(payload);
482+
481483
}
484+
this.refresh();
482485
},
486+
487+
//refresh function - super ghetto refresh function
488+
refresh() {
489+
const payload = {
490+
activeComponent: this.activeComponent,
491+
routeArray: this.routes[this.activeRoute],
492+
activeComponentData: this.activeComponentData,
493+
z: this.activeComponentData.z,
494+
};
495+
payload.z++;
496+
this.updateComponentLayer(payload);
497+
payload.z--;
498+
this.updateComponentLayer(payload);
499+
},
500+
483501
finishedDrag: function (x, y) {
484502
let payload = {
485503
x: x,
@@ -496,6 +514,7 @@ export default {
496514
}
497515
this.wasDragged = true;
498516
setTimeout(()=>this.wasDragged = false, 100)
517+
this.refresh();
499518
},
500519
onActivated(componentData) {
501520
if (!componentData){
@@ -571,6 +590,7 @@ export default {
571590
activeComponentData: this.activeComponentData,
572591
z: this.activeComponentData.z,
573592
};
593+
574594
if (e.target.innerText === "+") payload.z++;
575595
if (e.target.innerText === "" && payload.z > 0) payload.z--;
576596
this.updateComponentLayer(payload);

src/components/left-sidebar/ComponentTab/AttributesSubMenu.vue

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
</q-list>
1818
</q-btn-dropdown>
1919

20-
2120
<q-input
2221
@keyup.enter="createAttribute(attributeText)"
2322
color="white"
@@ -35,6 +34,9 @@
3534
</template>
3635
</q-input>
3736

37+
<button v-if = "this.activeComponentObj.htmlAttributes.class !== ''" class = "deleteButton" @click="deleteAttribute('class')" color="primary">Remove class</button>
38+
39+
<button v-if = "this.activeComponentObj.htmlAttributes.id !== ''" class = "deleteButton" @click="deleteAttribute('id')" color="primary">Remove id</button>
3840

3941
<!-- <div>
4042
<q-btn
@@ -62,6 +64,7 @@ export default {
6264
return {
6365
attributeText: "",
6466
attributeSelection: "ID",
67+
deleteText:"",
6568
};
6669
},
6770
computed: {
@@ -94,8 +97,19 @@ export default {
9497
activeComponentData: this.activeComponentData,
9598
})
9699
},
100+
97101
changeAttribute(attribute) {
98102
this.attributeSelection = attribute;
103+
},
104+
105+
deleteAttribute(attribute) {
106+
this.editAttribute({
107+
attribute: attribute,
108+
value: "",
109+
activeComponent: this.activeComponent,
110+
routeArray: this.routes[this.activeRoute],
111+
activeComponentData: this.activeComponentData,
112+
})
99113
}
100114
},
101115
};
@@ -110,9 +124,23 @@ export default {
110124
}
111125
112126
.input-add {
113-
position:absolute;
114-
margin-left: 7em;
115-
bottom:-60%;
116-
// padding:20px;
127+
// position:absolute;
128+
// margin-left: 7em;
129+
// bottom:-100%;
130+
margin-top:1em;
131+
margin-bottom: -1em;
117132
}
133+
.deleteButton{
134+
width:100px;
135+
height:30px;
136+
background-color:rgba(204, 190, 190, 0.164);
137+
color: $menutext;
138+
margin-right:2em;
139+
}
140+
141+
.deleteButton:hover{
142+
cursor: pointer;
143+
}
144+
145+
118146
</style>

src/components/right-sidebar/CodeSnippet.vue

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,15 @@ export default {
7474
// Creates beginner boilerplate
7575
createTemplate(componentName) {
7676
let templateTagStr = this.writeTemplateTag(componentName);
77-
return `<template>\n <div>\n${templateTagStr} </div>\n</template>`;
77+
78+
//if/else statement to determine if there are class and id attributes present in the html element
79+
if (this.activeComponentObj.htmlAttributes.class !== "" && this.activeComponentObj.htmlAttributes.id !== "") {
80+
return `<template>\n <div id = "${this.activeComponentObj.htmlAttributes.id}" class = "${this.activeComponentObj.htmlAttributes.class}">\n${templateTagStr} </div>\n</template>`;
81+
} else if (this.activeComponentObj.htmlAttributes.class !== "" && this.activeComponentObj.htmlAttributes.id === "") {
82+
return `<template>\n <div class = "${this.activeComponentObj.htmlAttributes.class}">\n${templateTagStr} </div>\n</template>`;
83+
} else if (this.activeComponentObj.htmlAttributes.class === "" && this.activeComponentObj.htmlAttributes.id !== "")
84+
return `<template>\n <div id = "${this.activeComponentObj.htmlAttributes.id}">\n${templateTagStr} </div>\n</template>`;
85+
else return `<template>\n <div>\n${templateTagStr} </div>\n</template>`;
7886
},
7987
// Creates <template> boilerplate
8088
writeTemplateTag(componentName) {
@@ -238,7 +246,8 @@ export default {
238246
for (const html of htmlArray) {
239247
if (html.class === ' ') styleString = "";
240248
if (html.class) {
241-
styleString += `.${html.class} {\n}\n`
249+
styleString += `.${html.class} {\n
250+
}\n`
242251
}
243252
}
244253

src/store/mutations.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,21 @@ const mutations = {
631631
updatedComponent.x = payload.x;
632632
updatedComponent.y = payload.y;
633633
},
634+
//color updater
635+
[types.UPDATE_COLOR]: (state, payload) => {
636+
const updatedComponent = state.routes[state.activeRoute].filter(
637+
(element) => element.componentName === payload.activeComponent
638+
)[0];
639+
640+
updatedComponent.color = payload.color
641+
},
642+
643+
[types.EDIT_ATTRIBUTE]: (state, payload) => {
644+
const updatedComponent = state.routes[state.activeRoute].filter(
645+
(element) => element.componentName === payload.activeComponent
646+
)[0];
647+
updatedComponent.htmlAttributes[payload.attribute] = payload.value
648+
},
634649

635650
[types.UPDATE_COMPONENT_LAYER]: (state, payload) => {
636651
const updatedComponent = state.routes[state.activeRoute].filter(

0 commit comments

Comments
 (0)