Skip to content

Commit e55a143

Browse files
committed
created action mutation type
1 parent 41b5204 commit e55a143

File tree

4 files changed

+13
-39
lines changed

4 files changed

+13
-39
lines changed

src/components/right-sidebar/CodeSnippet.vue

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ Description:
1111
<div class="top-p" v-if="this.activeComponent === ''">
1212
Select a component
1313
</div>
14-
<div v-else>{{ `${this.activeComponent}.vue` }}</div> <button class="refreshCode">
15-
<q-icon size="25px" z-layer="0" name="refresh" @click="this.snippetInvoke" />
16-
</button>
14+
<div v-else>{{ `${this.activeComponent}.vue` }}</div>
1715
<prism-editor v-model="code" :highlight="highlighter" line-numbers class="my-editor" readonly />
1816
</div>
1917
</template>
@@ -76,16 +74,7 @@ export default {
7674
// Creates beginner boilerplate
7775
createTemplate(componentName) {
7876
let templateTagStr = this.writeTemplateTag(componentName);
79-
<<<<<<< HEAD
80-
if (this.activeComponentObj.htmlAttributes.class !== "") return `<template>\n <div class = "${this.activeComponentObj.htmlAttributes.class}">\n${templateTagStr} </div>\n</template>`;
81-
else return `<template>\n <div>\n${templateTagStr} </div>\n</template>`;
82-
83-
=======
84-
console.log(this.activeComponentObj)
85-
// if(this.activeComponentObj.htmlAttributes.class !== "") return `<template>\n <div class = "${this.activeComponentObj.htmlAttributes.class}">\n${templateTagStr} </div>\n</template>`;
86-
// else return `<template>\n <div>\n${templateTagStr} </div>\n</template>`;
87-
88-
>>>>>>> d43111c7d7f70bf069d8763816730ae516810d3f
77+
return `<template>\n <div>\n${templateTagStr} </div>\n</template>`;
8978
},
9079
// Creates <template> boilerplate
9180
writeTemplateTag(componentName) {
@@ -207,7 +196,7 @@ export default {
207196
children.forEach((name) => {
208197
childrenComponentNames += ` ${name},\n`;
209198
});
210-
199+
console.log("lets look at data", this.componentMap[this.activeComponent])
211200
// if true add data section and populate with props
212201
let data = "";
213202
if (this.componentMap[this.activeComponent].props.length) {
@@ -246,21 +235,10 @@ export default {
246235
247236
let htmlArray = this.componentMap[componentName].htmlList;
248237
let styleString = "";
249-
250-
if (this.activeComponentObj.htmlAttributes.class !== "") {
251-
styleString += `.${this.activeComponentObj.htmlAttributes.class} {\nbackground-color: ${this.activeComponentObj.color};
252-
width: ${this.activeComponentObj.w}px;
253-
height: ${this.activeComponentObj.h}px;
254-
z-index: ${this.activeComponentObj.z}px;
255-
}\n`
256-
}
257-
258238
for (const html of htmlArray) {
259239
if (html.class === ' ') styleString = "";
260240
if (html.class) {
261-
console.log(this.activeComponentObj)
262-
styleString += `.${html.class} {\n
263-
}\n`
241+
styleString += `.${html.class} {\n}\n`
264242
}
265243
}
266244
@@ -352,17 +330,5 @@ z-index: ${this.activeComponentObj.z}px;
352330
.prism-editor__textarea:focus {
353331
outline: none;
354332
}
355-
356-
.refreshCode {
357-
position: absolute;
358-
background-color: black;
359-
color: $secondary;
360-
bottom: 96%;
361-
right: 5%;
362-
}
363-
364-
.refreshCode:hover {
365-
cursor: pointer;
366-
}
367333
</style>
368334

src/store/actions.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,9 @@ const actions = {
109109
[types.updateComponentPosition]: ({ commit }, payload) => {
110110
commit(types.UPDATE_COMPONENT_POSITION, payload);
111111
},
112+
[types.addBinding]: ({ commit }, payload) => {
113+
commit(types.ADD_BINDING, payload);
114+
},
112115

113116
[types.updateComponentSize]: ({ commit }, payload) => {
114117
commit(types.UPDATE_COMPONENT_SIZE, payload);

src/store/mutations.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,10 @@ const mutations = {
206206
[state.activeComponent]: state.activeComponentObj,
207207
};
208208
},
209-
209+
//add binding
210+
[types.ADD_BINDING]: (state, payload) => {
211+
//access the htmlList, add payload to the empty bind obj
212+
},
210213
[types.DELETE_ACTION_FROM_COMPONENT]: (state, payload) => {
211214
state.componentMap[state.activeComponent].actions = state.componentMap[state.activeComponent].actions.filter(
212215
(action) => action !== payload);

src/store/types.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ export const openAttributeModal = 'openAttributeModal'
8686
export const addActiveComponentClass = 'addActiveComponentClass'
8787
export const deleteActiveComponentClass = 'deleteActiveComponentClass'
8888

89+
//adding vmodel info
90+
export const ADD_BINDING = 'ADD_BINDING'
8991
//
9092
export const deleteActiveComponentNote = 'deleteActiveComponentNote'
9193
export const addActiveComponentNote = 'addActiveComponentNote'

0 commit comments

Comments
 (0)