commit | author | age
|
a34f1d
|
1 |
<template> |
D |
2 |
<div> |
fbee7b
|
3 |
<div class="itemCardAndFlag"> |
A |
4 |
|
3f23cc
|
5 |
<md-list-item |
ba91cd
|
6 |
@click="markCompleted" |
3f23cc
|
7 |
> |
A |
8 |
<!-- TODO find a nice way of not calling markdone when clicking flag on card rather than calling "markDone" twice --> |
|
9 |
|
|
10 |
<!-- Material design checkbox not displaying, EDIT: Still can't figure out why it's not displaying --> |
|
11 |
<!-- <md-checkbox :v-model="isActive">x</md-checkbox> --> |
8acdfc
|
12 |
<!-- <input type="checkbox" v-model="todoItem.complete"/> --> |
e38844
|
13 |
<checkbox v-model="todoItem.completed"/> |
b4180d
|
14 |
|
e38844
|
15 |
<span class="md-list-item-text" :class="{'strike-through': todoItem.completed}">{{ todoItem.title }}</span> |
b4180d
|
16 |
<!-- find a nice way to utilise svg fill property without doing it inline --> |
A |
17 |
<md-button |
|
18 |
@click="markImportant" |
|
19 |
> |
ba91cd
|
20 |
<svg :class="{'red-flag': todoItem.important}" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg" @click="markCompleted"> |
b4180d
|
21 |
<path d="M0 0h24v24H0z" fill="none"/> |
A |
22 |
<path d="M14.4 6L14 4H5v17h2v-7h5.6l.4 2h7V6z"/> |
|
23 |
</svg> |
|
24 |
</md-button> |
a34f1d
|
25 |
</md-list-item> |
fbee7b
|
26 |
</div> |
a34f1d
|
27 |
</div> |
D |
28 |
</template> |
|
29 |
<script> |
8acdfc
|
30 |
import Vue from "vue"; |
1f415e
|
31 |
import { Checkbox, Radio } from "vue-checkbox-radio"; |
A |
32 |
Vue.component("checkbox", Checkbox); |
|
33 |
Vue.component("radio", Radio); |
8acdfc
|
34 |
|
a34f1d
|
35 |
export default { |
D |
36 |
name: "TodoItem", |
|
37 |
props: { |
|
38 |
// type any object ;) |
|
39 |
todoItem: {} |
|
40 |
}, |
acdeac
|
41 |
data() { |
a34f1d
|
42 |
return { |
0f0a91
|
43 |
// isActive: false, |
A |
44 |
// isImportant: false |
acdeac
|
45 |
}; |
a34f1d
|
46 |
}, |
D |
47 |
methods: { |
ba91cd
|
48 |
markCompleted() { |
D |
49 |
this.$store.dispatch("markTodoCompleted", this.todoItem._id); |
|
50 |
console.info("INFO - Mark Item as completed ", this.todoItem.completed); |
b4180d
|
51 |
}, |
A |
52 |
markImportant() { |
ba91cd
|
53 |
// TODO - FILL THIS OUT IN THE LAB EXERCISE |
8f43d3
|
54 |
// this.$store.dispatch("updateTodo", this.todoItem); |
0f0a91
|
55 |
console.info("INFO - ", this.todoItem, this.todoItem.important); |
a34f1d
|
56 |
} |
D |
57 |
} |
|
58 |
}; |
|
59 |
</script> |
|
60 |
|
|
61 |
<!-- Add "scoped" attribute to limit CSS to this component only --> |
|
62 |
<style scoped lang="scss"> |
|
63 |
.md-list { |
acdeac
|
64 |
width: 320px; |
A |
65 |
max-width: 100%; |
|
66 |
height: 400px; |
|
67 |
display: inline-block; |
|
68 |
overflow: auto; |
|
69 |
border: 1px solid rgba(#000, 0.12); |
|
70 |
vertical-align: top; |
991fff
|
71 |
} |
A |
72 |
|
8acdfc
|
73 |
.md-list-item-text { |
A |
74 |
padding-left: 0.5em; |
|
75 |
} |
|
76 |
|
a34f1d
|
77 |
.strike-through { |
D |
78 |
text-decoration: line-through; |
b4180d
|
79 |
font-style: italic; |
A |
80 |
} |
|
81 |
|
|
82 |
.red-flag { |
|
83 |
fill: #cc0000; |
a34f1d
|
84 |
} |
D |
85 |
</style> |