-
-
Notifications
You must be signed in to change notification settings - Fork 198
/
InfoViewer.vue
96 lines (93 loc) · 2.42 KB
/
InfoViewer.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
<template>
<div>
<v-expansion-panels
:disabled="Object.keys(info).length < 1"
class="collapse"
>
<v-expansion-panel>
<v-expansion-panel-header v-if="Object.keys(info).length > 0">
{{ info.description }}
</v-expansion-panel-header>
<v-expansion-panel-content>
<div style="text-align: left">
<div style="margin-bottom: 10px">
<span>
<b class="mr-2">Authors:</b>
<template v-for="(author, index) in info.authors">
<v-chip
v-if="author.link"
:key="index"
medium
:href="author.link"
class="mr-1 mb-1"
>
{{ formatDisplayName(author) }}
</v-chip>
<v-chip
v-else
:key="index"
medium
target="_blank"
rel="noopener noreferrer"
class="mr-1 mb-1"
>
{{ formatDisplayName(author) }}
</v-chip>
</template>
</span>
</div>
<div style="margin-bottom: 10px">
<span>
<b class="mr-2">Comments:</b>
<ul>
<li v-for="(comment, index) in info.comments" :key="index">
{{ comment }}
</li>
</ul>
</span>
</div>
</div>
<div
v-for="detail in info.extraDetails"
:key="detail.key"
style="margin-bottom: 10px"
>
<span>
<b>{{ detail.key }}:</b>
{{ detail.value }}
</span>
</div>
</v-expansion-panel-content>
</v-expansion-panel>
</v-expansion-panels>
</div>
</template>
<script>
export default {
props: {
info: {
type: Object,
default: () => {},
},
},
methods: {
formatDisplayName(author) {
if (author.name && author.handle) {
return `${author.name} (${author.handle})`;
}
if (author.name) {
return author.name;
}
if (author.handle) {
return author.handle;
}
return "";
},
},
};
</script>
<style lang="scss" scoped>
.collapse {
margin-bottom: 25px;
}
</style>