-
Notifications
You must be signed in to change notification settings - Fork 709
/
AccessibleResourceCard.vue
121 lines (107 loc) · 2.71 KB
/
AccessibleResourceCard.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
<template>
<KCard
:to="to"
:headingLevel="headingLevel"
:orientation="windowBreakpoint === 0 ? 'vertical' : 'horizontal'"
thumbnailDisplay="large"
:title="contentNode.title"
:thumbnailSrc="thumbnailSrc"
thumbnailAlign="right"
:thumbnailScaleType="thumbnailScaleType"
>
<template #thumbnailPlaceholder>
<div class="default-resource-icon">
<LearningActivityIcon :kind="contentNode.learning_activities" />
</div>
</template>
<template #belowTitle>
<div>
<KTextTruncator
:text="contentNode.description"
:maxLines="2"
/>
</div>
</template>
<template #footer>
<div class="default-icon">
<KIconButton
:icon="isBookmarked ? 'bookmark' : 'bookmarkEmpty'"
size="mini"
:color="$themePalette.grey.v_700"
:ariaLabel="coreString('savedFromBookmarks')"
:tooltip="coreString('savedFromBookmarks')"
@click.stop="isBookmarked = !isBookmarked"
/>
<KIconButton
icon="infoOutline"
size="mini"
:color="$themePalette.grey.v_700"
:ariaLabel="coreString('viewInformation')"
:tooltip="coreString('viewInformation')"
@click.stop="$emit('toggleInfo')"
/>
</div>
</template>
</KCard>
</template>
<script>
import { validateLinkObject } from 'kolibri/utils/validators';
import commonCoreStrings from 'kolibri/uiText/commonCoreStrings';
import useKResponsiveWindow from 'kolibri-design-system/lib/composables/useKResponsiveWindow';
import LearningActivityIcon from './../ResourceDisplayAndSearch/LearningActivityIcon.vue';
export default {
name: 'AccessibleResourceCard',
components: {
LearningActivityIcon,
},
mixins: [commonCoreStrings],
setup() {
const { windowBreakpoint } = useKResponsiveWindow();
return {
windowBreakpoint,
};
},
props: {
to: {
type: Object,
required: true,
validator: validateLinkObject,
},
contentNode: {
type: Object,
required: true,
},
headingLevel: {
type: Number,
required: true,
},
thumbnailSrc: {
type: String,
default: null,
},
thumbnailScaleType: {
type: String,
default: 'centerInside',
},
},
data() {
return {
isBookmarked: false,
};
},
computed: {},
};
</script>
<style lang="scss" scoped>
.default-resource-icon {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
font-size: 48px;
}
.default-icon {
text-align: right;
}
</style>