Skip to content

Commit bfd5e4d

Browse files
refactor: extract contributor (#75)
1 parent 6d02471 commit bfd5e4d

File tree

2 files changed

+56
-29
lines changed

2 files changed

+56
-29
lines changed

src/utils/contributor.ts

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export interface RawContributor {
1010
github: string
1111
blog?: string
1212
twitter?: string
13+
title?: string
1314
audios?: Link[]
1415
videos?: Link[]
1516
description: string

src/views/contributor.vue

+55-29
Original file line numberDiff line numberDiff line change
@@ -26,40 +26,66 @@ if (contributor.value)
2626
</script>
2727

2828
<template>
29-
<div v-if="contributor" mx-auto mt-5 px-4 container>
30-
<div mb-5>
31-
<h1 mb-2 text-center text-2xl font-bold v-html="contributor.name" />
29+
<div v-if="contributor" mx10>
30+
<div flex="~ col items-center">
31+
<!-- avatars -->
32+
<img
33+
:src="`https://avatars.githubusercontent.com/${contributor.github}`"
34+
:alt="contributor.name"
35+
my5
36+
w-100px
37+
rd-3
38+
/>
3239

33-
<a :href="`https://github.com/${contributor.github}`" target="_blank">
34-
<img
35-
:src="`https://avatars.githubusercontent.com/${contributor.github}`"
36-
:alt="contributor.github"
37-
class="w-128px"
38-
/>
39-
</a>
40+
<!-- name -->
41+
<h1 text-2xl font-bold v-html="contributor.name" />
4042

41-
<span v-if="contributor.twitter">
42-
Twitter:
43-
<a :href="`https://twitter.com/${contributor.twitter}`" target="_blank">
44-
{{ contributor.twitter }}
45-
</a>
46-
</span>
43+
<!-- title -->
44+
<span v-if="contributor.title">{{ contributor.title }}</span>
4745

48-
<component :is="contributor.default" />
46+
<!-- social -->
47+
<div flex="~ row gap-2 wrap justify-center">
48+
<span v-if="contributor.github" flex="~ items-center">
49+
<div i-carbon-logo-github text="[var(--text-color)]" mr1 />
50+
<a :href="`https://github.com/${contributor.github}`" target="_blank">
51+
{{ contributor.github }}
52+
</a>
53+
</span>
54+
<span v-if="contributor.twitter" flex="~ items-center">
55+
<div i-carbon-logo-x text="[var(--text-color)]" mr1 />
56+
<a
57+
:href="`https://twitter.com/${contributor.twitter}`"
58+
target="_blank"
59+
>
60+
{{ contributor.twitter }}
61+
</a>
62+
</span>
63+
</div>
4964

50-
<span v-if="contributor.audios">
51-
Podcast List:
52-
<li v-for="audio in contributor.audios" :key="audio.title">
53-
<a :href="`${audio.link}`" target="_blank">{{ audio.title }}</a>
54-
</li>
55-
</span>
65+
<!-- history -->
66+
<div mt5>
67+
<div v-if="contributor.audios">
68+
Podcast List:
69+
<li v-for="audio in contributor.audios" :key="audio.title">
70+
<a :href="`${audio.link}`" target="_blank" break-all>{{
71+
audio.title
72+
}}</a>
73+
</li>
74+
</div>
75+
<div v-if="contributor.videos" mt2>
76+
Video List:
77+
<li v-for="video in contributor.videos" :key="video.title">
78+
<a :href="`${video.link}`" target="_blank" break-all>{{
79+
video.title
80+
}}</a>
81+
</li>
82+
</div>
83+
</div>
5684

57-
<span v-if="contributor.videos">
58-
Video List:
59-
<li v-for="video in contributor.videos" :key="video.title">
60-
<a :href="`${video.link}`" target="_blank">{{ video.title }}</a>
61-
</li>
62-
</span>
85+
<!-- profile -->
86+
<div mt5 pb10 pt5 container border-y="1px solid [var(--border-color)]">
87+
<component :is="contributor.default" />
88+
</div>
6389
</div>
6490
</div>
6591
</template>

0 commit comments

Comments
 (0)