-
Notifications
You must be signed in to change notification settings - Fork 2
/
person.astro
163 lines (147 loc) · 3.54 KB
/
person.astro
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
---
import { Image } from "astro:assets";
import type { CollectionEntry } from "astro:content";
import LinkedInLogo from "~icons/ph/linkedin-logo";
import GithubLogo from "~icons/ph/github-logo";
import MatrixLogo from "~icons/tabler/brand-matrix";
interface Props {
person: CollectionEntry<"people">;
}
const { person } = Astro.props;
const { givenName, familyName, position, phone, email, image, socialMedia } =
person.data;
const name = `${givenName} ${familyName}`;
const imageAlt = person.data.imageAlt ?? `Bilde av ${name}`;
---
<div class="employee">
<Image
src={image}
width={600}
height={800}
alt={imageAlt}
class="profile-image"
/>
<div class="section">
<div class="intro">
<div class="description">
<p class="name">{name}</p>
<p class="position">{position}</p>
</div>
{
socialMedia.length > 0 && (
<ul class="social-media-links">
{socialMedia
.filter((link) => link.type === "linkedin")
.map((link) => (
<li>
<a
href={link.url}
target="_blank"
rel="noopener"
aria-label={`Gå til LinkedIn-profilen til ${name}`}
>
<LinkedInLogo />
</a>
</li>
))}
{socialMedia
.filter((link) => link.type === "github")
.map((link) => (
<li>
<a
href={link.url}
target="_blank"
rel="noopener"
aria-label={`Gå til GitHub-profilen til ${name}`}
>
<GithubLogo />
</a>
</li>
))}
{socialMedia
.filter((link) => link.type === "matrix")
.map((link) => (
<li>
<a
href={link.url}
target="_blank"
rel="noopener"
aria-label={`Kontakt ${name} på Matrix`}
>
<MatrixLogo />
</a>
</li>
))}
</ul>
)
}
</div>
</div>
<div class="details">
{
typeof phone === "string" ? (
<a href={`tel:${phone}`}>{phone}</a>
) : (
phone.map((phone) => <a href={`tel:${phone}`}>{phone}</a>)
)
}
<a href={`mailto:${email}`}>{email}</a>
</div>
</div>
<style>
.employee {
display: flex;
flex-direction: column;
gap: 1rem;
}
a {
text-decoration: none;
}
@media (hover) {
a:hover {
--link-color: hsl(var(--blue-base) 40%);
text-decoration: underline;
text-decoration-skip-ink: none;
text-decoration-thickness: 0.125em;
text-underline-offset: 0.125em;
}
}
.section {
display: flex;
flex-direction: column;
gap: 1rem;
}
.profile-image {
width: 100%;
height: auto;
object-fit: cover;
aspect-ratio: 3/4;
}
.description > * {
margin: 0;
}
.description > .name {
font-weight: 600;
}
.description > .position {
color: var(--color-low-contrast-text);
}
.details > * {
display: block;
}
.intro {
display: flex;
justify-content: space-between;
}
img {
border-radius: 4px;
}
.social-media-links {
display: flex;
flex-direction: row;
gap: 0.25rem;
list-style: none;
padding: 0;
margin: 0;
}
</style>