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