forked from ProtoSchool/protoschool.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLessonLink.vue
More file actions
69 lines (62 loc) · 1.79 KB
/
Copy pathLessonLink.vue
File metadata and controls
69 lines (62 loc) · 1.79 KB
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
<template>
<router-link :to="to" class="link db pa3 green bb b--white">
<div class="flex items-start justify-between">
<div class="flex flex-row">
<div v-if="isResources" class="flex-ns items-center-ns dn tl green ttu f6" style="min-width: 93px">Resources</div>
<div v-else class="flex-ns items-center dn tl green ttu f6" style="min-width: 93px">Lesson {{lessonNumber}}</div>
<div class="flex-ns items-center-ns pr3" style="flexShrink: 0">
<img v-if="getLessonValue('passed' + to)" src="../static/images/complete.svg" alt="complete" style="height: 1rem;"/>
<img v-else-if="getLessonValue('cached' + to)" src="../static/images/in-progress.svg" alt="in progress" style="height: 1rem;"/>
<img v-else src="../static/images/not-started.svg" alt="not yet started" style="height: 0.9rem;"/>
</div>
<div class="navy fw5 mw6">{{lesson.title}}</div>
</div>
<TypeIcon
:tutorialId="tutorialId"
:lessonId="isResources? 'resources' : lessonId"
class="link-icon ml3"
/>
</div>
</router-link>
</template>
<script>
import TypeIcon from '../components/TypeIcon.vue'
export default {
name: 'LessonLink',
props: {
to: String,
lessonNumber: Number,
lesson: Object,
lessonId: String,
tutorialId: [String, undefined]
},
components: {
TypeIcon
},
computed: {
isResources: function () {
return this.to.split('/')[2] === 'resources'
}
},
methods: {
getLessonValue: function (lessonKey) {
return !!localStorage[lessonKey]
}
}
}
</script>
<style scoped>
.link {
background: #f2f5f6;
transition: background 400ms;
}
.link:focus-within,
.link:hover,
.link:focus {
background: #bfe5e9;
}
.link-icon {
height: 1.3rem;
min-width: 1.3rem;
}
</style>