-
Notifications
You must be signed in to change notification settings - Fork 88
/
Copy pathTeamMember.tsx
123 lines (120 loc) · 4.15 KB
/
TeamMember.tsx
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
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*/
import * as React from 'react';
import Image from 'next/legacy/image';
import {IconTwitter} from '../Icon/IconTwitter';
import {IconThreads} from '../Icon/IconThreads';
import {IconBsky} from '../Icon/IconBsky';
import {IconGitHub} from '../Icon/IconGitHub';
import {ExternalLink} from '../ExternalLink';
import {H3} from './Heading';
import {IconLink} from 'components/Icon/IconLink';
interface TeamMemberProps {
name: string;
title: string;
permalink: string;
children: React.ReactNode;
photo: string;
twitter?: string;
threads?: string;
bsky?: string;
github?: string;
personal?: string;
}
// TODO: good alt text for images/links
export function TeamMember({
name,
title,
permalink,
children,
photo,
github,
twitter,
threads,
bsky,
personal,
}: TeamMemberProps) {
if (name == null || title == null || permalink == null || children == null) {
const identifier = name ?? title ?? permalink ?? 'unknown';
throw new Error(
`Expected name, title, permalink, and children for ${identifier}`
);
}
return (
<div className="pb-6 sm:pb-10">
<div className="flex flex-col sm:flex-row height-auto">
<div
className="hidden sm:block basis-2/5 rounded overflow-hidden relative"
style={{width: 300, height: 250}}>
<Image src={photo} layout="fill" objectFit="cover" alt={name} />
</div>
<div
style={{minHeight: 300}}
className="block w-full sm:hidden flex-grow basis-2/5 rounded overflow-hidden relative">
<Image src={photo} layout="fill" objectFit="cover" alt={name} />
</div>
<div className="ps-0 sm:ps-6 basis-3/5 items-start">
<H3 className="mb-1 sm:my-0" id={permalink}>
{name}
</H3>
{title && <div>{title}</div>}
{children}
<div className="sm:flex sm:flex-row flex-wrap text-secondary dark:text-secondary-dark">
{twitter && (
<div className="me-4">
<ExternalLink
aria-label={`${name} on Twitter`}
href={`https://twitter.com/${twitter}`}
className="hover:text-primary hover:underline dark:text-primary-dark flex flex-row items-center">
<IconTwitter className="pe-1" />
{twitter}
</ExternalLink>
</div>
)}
{threads && (
<div className="me-4">
<ExternalLink
aria-label={`${name} on Threads`}
href={`https://threads.net/${threads}`}
className="hover:text-primary hover:underline dark:text-primary-dark flex flex-row items-center">
<IconThreads className="pe-1" />
{threads}
</ExternalLink>
</div>
)}
{bsky && (
<div className="me-4">
<ExternalLink
aria-label={`${name} on Bluesky`}
href={`https://bsky.app/profile/${bsky}`}
className="hover:text-primary hover:underline dark:text-primary-dark flex flex-row items-center">
<IconBsky className="pe-1" />
{bsky}
</ExternalLink>
</div>
)}
{github && (
<div className="me-4">
<ExternalLink
aria-label="GitHub Profile"
href={`https://github.com/${github}`}
className="hover:text-primary hover:underline dark:text-primary-dark flex flex-row items-center">
<IconGitHub className="pe-1" /> {github}
</ExternalLink>
</div>
)}
{personal && (
<ExternalLink
aria-label="Personal Site"
href={`https://${personal}`}
className="hover:text-primary hover:underline dark:text-primary-dark flex flex-row items-center">
<IconLink className="pe-1" /> {personal}
</ExternalLink>
)}
</div>
</div>
</div>
</div>
);
}