-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcomponents.js
100 lines (94 loc) · 4.17 KB
/
components.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
Vue.component('close-svg', {
template: `<svg id="update_exit" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 23 23" >
<circle cx="12" cy="12" r="11" fill="grey" />
<path stroke="white" stroke-width="4" fill="none" d="M6.25,6.25,17.75,17.75" />
<path stroke="white" stroke-width="4" fill="none" d="M6.25,17.75,17.75,6.25" />
</svg>`
});
Vue.component('add-svg', {
template: `<svg id="add_icon_button" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" width="48" height="48" viewBox="0 0 48 48" style=" fill:#000000;">
<path fill="#4caf50" d="M44,24c0,11.045-8.955,20-20,20S4,35.045,4,24S12.955,4,24,4S44,12.955,44,24z"></path>
<path fill="#fff" d="M22,15h4v18h-4V15z"></path>
<path fill="#fff" d="M15,22h18v4H15V22z"></path>
</svg>`
});
Vue.component('nav-bar', {
template: `<div id="navigation">
<a id="dictionaryMenu" :class="{ active: seenDictionary }" @click="$emit('click-nav', 'dictionary')">Dictionary</a>
<a id="quizMenu" :class="{ active: seenQuiz }" @click="$emit('click-nav', 'quiz')">Quiz</a>
<a id="scoreMenu" :class="{ active: seenScore }" @click="$emit('click-nav', 'score')">Score</a>
</div>`,
props: ["seen-dictionary", "seen-quiz", "seen-score", ]
});
Vue.component('update-form', {
template: `<div id="update_form" v-if="seenTable" ref="update_form">
<input class="input" type="text" id="update_character" v-model="characterInput" ref="character">
<input class="input" type="text" id="update_english" v-model="englishInput" ref="english">
<input class="input" type="text" id="update_group" v-model="groupInput" ref="group">
<button id="update_button" @click="$emit('click-u')">Edit</button>
<close-svg @click.native="$emit('click-ue')"></close-svg>
</div>`,
props: ["character", "english", "group", "seen-table"],
computed: {
characterInput: {
get: function () {
return this.character;
},
set: function (newValue) {
this.$emit('update:character', newValue)
}
},
englishInput: {
get: function () {
return this.english;
},
set: function (newValue) {
this.$emit('update:english', newValue)
}
},
groupInput: {
get: function () {
return this.group;
},
set: function (newValue) {
this.$emit('update:group', newValue)
}
}
}
});
Vue.component('add-form', {
template: `<div id="add_form" v-if="seenAdd" :style="seenAdd ? 'display:block' : 'display:none'">
<input type="text" class="input" id="add_character" placeholder="character" v-model="characterInput" ref="character">
<input type="text" class="input" id="add_english" placeholder="english" v-model="englishInput" ref="english">
<input type="text" class="input" id="add_group" placeholder="group" v-model="groupInput" ref="group">
<button id="add_button" @click="$emit('click-a')">Add</button>
<close-svg @click.native="$emit('click-ae')"></close-svg>
</div>`,
props: ["character", "english", "group", "seen-add"],
computed: {
characterInput: {
get: function () {
return this.character;
},
set: function (newValue) {
this.$emit('update:character', newValue)
}
},
englishInput: {
get: function () {
return this.english;
},
set: function (newValue) {
this.$emit('update:english', newValue)
}
},
groupInput: {
get: function () {
return this.group;
},
set: function (newValue) {
this.$emit('update:group', newValue)
}
}
}
});