/
Contributor.vue
124 lines (115 loc) · 2.76 KB
/
Contributor.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
<template>
<Layout>
<Section container="md" class="blog-posts">
<div class="mb-x2 container-sm text-center author-page">
<g-image class="author-page__avatar" v-if="$page.contributor.avatar" :key="$page.contributor.id" :src="$page.contributor.avatar"/>
<h1>{{ $page.contributor.title }}</h1>
<p v-if="$page.contributor.bio" class="lead container-sm">
{{ $page.contributor.bio }}
</p>
<a v-if="$page.contributor.twitter" :href="`https://twitter.com/${$page.contributor.twitter}`">
{{ $page.contributor.twitter }}
</a>
</div>
<h3 class="text-center" v-if="$page.contributor.posts.edges.length">Blog posts</h3>
<PostCard v-for="edge in $page.contributor.posts.edges" :key="edge.node.id" :post="edge.node"/>
<h3 class="text-center" v-if="$page.contributor.starters.edges.length">Starters</h3>
<div class="grid-cols grid-cols--2">
<StarterCard v-for="starter in $page.contributor.starters.edges" :key="starter.node.id" :node="starter.node" />
</div>
</Section>
</Layout>
</template>
<page-query>
query ($id: ID!) {
contributor (id: $id) {
id
title
bio
avatar (width: 124)
twitter
posts: belongsTo(filter: {typeName: {eq: BlogPost}}) {
totalCount
pageInfo {
totalPages
currentPage
}
edges {
node {
...on BlogPost {
id
title
path
date (format: "D. MMMM YYYY")
timeToRead
author {
id
title
path
}
excerpt
content
}
}
}
}
starters: belongsTo(filter: {typeName: {eq: Starter}}) {
totalCount
pageInfo {
totalPages
currentPage
}
edges {
node {
...on Starter {
id
title
description
preview
repo
platforms {
title
logo
}
author {
title
path
}
path
screenshot (width: 840, height:840)
}
}
}
}
}
}
</page-query>
<script>
import PostCard from '@/components/PostCard.vue'
import StarterCard from '@/components/StarterCard.vue'
export default {
components: {
PostCard,
StarterCard
},
metaInfo () {
return {
title: this.$page.contributor.title,
meta: [
{
key: 'description',
name: 'description',
content: this.$page.contributor.bio
}
]
}
}
}
</script>
<style lang="scss">
.author-page {
&__avatar {
border-radius: 99px;
}
}
</style>