Skip to content

Commit d885432

Browse files
feat(whats-new): DLT-3450 show author photos from GitHub avatars (#1302)
1 parent 22faacf commit d885432

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

apps/dialtone-documentation/docs/.vuepress/baseComponents/BlogPost.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
:size="300"
2424
:seed="author"
2525
:full-name="author"
26+
:image-src="avatarSrc"
27+
:image-alt="`${author} avatar`"
2628
/>
2729
<dt-stack>
2830
<dt-text :size="200" kind="label" tone="secondary" density="200">
@@ -56,8 +58,9 @@
5658
import { format } from 'date-fns';
5759
import { computed } from 'vue';
5860
import CopyButton from './CopyButton.vue';
61+
import { authorAvatarUrl } from './authorHandles.js';
5962
60-
defineProps({
63+
const props = defineProps({
6164
posted: {
6265
type: Date,
6366
required: true,
@@ -80,6 +83,8 @@ defineProps({
8083
},
8184
});
8285
86+
const avatarSrc = computed(() => authorAvatarUrl(props.author));
87+
8388
const blogLink = computed(() => {
8489
return window.location.href;
8590
});
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
export const authorHandles = {
2+
'Brad Paugh': 'braddialpad',
3+
'Francis Rupert': 'francisrupert',
4+
'Tico Ortega': 'juliodialpad',
5+
'Nina Repetto': 'ninarepetto',
6+
'Yorbi Barriento': 'yorbi-dp',
7+
'Julio Ortega': 'juliodialpad',
8+
'Federico Sarassola': 'fede-dp',
9+
'Josh Everhart': 'jeverhart-dialpad',
10+
'Joshua Hynes': 'hynes-dialpad',
11+
'Belu Montoya': 'belumontoya',
12+
'Ignacio Ropolo': 'iropolo',
13+
'Paulo Reis': 'paulojreis-dialpad',
14+
};
15+
16+
// Returns the GitHub avatar URL for an author, or '' if unmapped.
17+
// '' means DtAvatar renders seeded initials (the unmapped fallback).
18+
export function authorAvatarUrl (author) {
19+
const handle = authorHandles[author];
20+
return handle ? `https://github.com/${handle}.png` : '';
21+
}

0 commit comments

Comments
 (0)