-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathflashcard.vue
138 lines (131 loc) · 3.59 KB
/
flashcard.vue
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<template>
<div>
<div @click="isToggle=!isToggle" v-bind:style="{backgroundColor: colorFront, color: colorTextFront}" v-show="!isToggle" class="animated flipInX flashcard">
<div class="card-header" style="padding-bottom: 15px;"> {{headerFront}} </div>
<div class="card-content center">
<p v-bind:style="{fontSize: textSizeFront,fontWeight: 'bold'}">{{front}}</p>
<img v-if="imgFront!=''" :src="imgFront" width="200" height="200">
</div>
<div class="card-footer">{{footerFront}}</div>
</div>
<div @click="isToggle=!isToggle" v-bind:style="{backgroundColor: colorBack, color: colorTextBack}" v-show="isToggle" class="animated flipInX flashcard">
<div class="card-header" style="padding-bottom: 15px;"> {{headerBack}}</div>
<div class="card-content center">
<p v-bind:style="{fontSize: textSizeBack, fontWeight: 'bold'}">{{back}}</p>
<img v-if="imgBack!=''" :src="imgBack" width="200" height="200">
</div>
<div class="card-footer">{{footerBack}}</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
isToggle: false,
}
}, props: {
imgFront: {
type: String,
default: ''
},
imgBack: {
type: String,
default: ''
},
front: {
type: String,
default: ''
},
back: {
type: String,
default: ''
},
textSizeFront: {
type: String,
default: '2em'
},
textSizeBack: {
type: String,
default: '2em'
},
colorTextFront: {
type: String,
default: 'black'
},
colorTextBack: {
type: String,
default: 'white'
},
colorFront: {
type: String,
default: 'white'
},
colorBack: {
type: String,
default: '#2ecc71'
},
headerFront: {
type: String,
default: 'Do you know?'
},
headerBack: {
type: String,
default: 'Answer'
},
footerFront: {
type: String,
default: 'Click to show Back'
},
footerBack: {
type: String,
default: 'Click to show Front'
}
}
}
</script>
<style scoped>
.center {
text-align: center;
}
.flashcard {
cursor: pointer;
border-radius: 10px;
margin: 20px;
padding: 25px;
box-shadow: 0 0px 10px rgba(0, 0, 0, 0.4);
text-align: center;
}
.flashcard:hover {
box-shadow: 0 0px 25px rgba(0, 0, 0, 0.8);
}
.animated {
animation-duration: 1s;
animation-fill-mode: both;
}
@keyframes flipInX {
from {
transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
animation-timing-function: ease-in;
opacity: 0;
}
40% {
transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
animation-timing-function: ease-in;
}
60% {
transform: perspective(400px) rotate3d(1, 0, 0, 10deg);
opacity: 1;
}
80% {
transform: perspective(400px) rotate3d(1, 0, 0, -5deg);
}
to {
transform: perspective(400px);
}
}
.flipInX {
backface-visibility: visible !important;
animation-name: flipInX;
}
</style>