Skip to content

Commit 01f4313

Browse files
committed
fix: redesign avatar
1 parent ea135f3 commit 01f4313

File tree

2 files changed

+29
-8
lines changed

2 files changed

+29
-8
lines changed

components/PublicationCard/PublicationCard.module.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@
2525

2626
.publication-card--avatar {
2727
background-color: $orange;
28+
background-size: 50px;
2829
border-radius: 50%;
2930
color: black;
30-
height: 20px;
31-
min-width: 20px;
31+
height: 50px;
32+
min-width: 50px;
3233
position: relative;
3334
text-align: center;
35+
font-size: 40px;
3436
}
3537

3638
.publication-card--author {

components/PublicationCard/PublicationCard.tsx

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,42 @@
11
import { FC } from "react";
22
import { formatDate } from "../../lib/formatDate";
33
import { IPublication } from "../../lib/publications/publications.types";
4-
// import { IPublication } from "../../lib/publications/getPublications";
54
// import SanitizedHTML from 'react-sanitized-html';
65
import styles from "./PublicationCard.module.scss";
76

87
interface IPublicationCardProps {
98
publication: IPublication;
109
}
1110

11+
const avatars: Record<string, string> = {
12+
mdworld: "https://miro.medium.com/fit/c/176/176/0*gTl35Xy5zRcgu5wJ.png",
13+
"nathan perdijk":
14+
"https://miro.medium.com/fit/c/88/88/0*Bqr-dMZplB-namyY.jpg",
15+
"bjorn ‘bjeaurn’":
16+
"https://miro.medium.com/fit/c/176/176/0*o9UzuQyUwobacrCt.jpeg",
17+
"hamza haiken":
18+
"https://miro.medium.com/fit/c/176/176/2*1JTGoMi8_nuGQVO1EoItXg.png",
19+
"nick ten veen":
20+
"https://miro.medium.com/fit/c/88/88/2*k7vMxGfKwfqJ86TcprDA_Q.jpeg",
21+
};
22+
1223
const PublicationCard: FC<IPublicationCardProps> = ({ publication }) => {
13-
const { title, author, uniqueSlug, paragraphs, latestPublishedAt } =
14-
publication;
24+
const { title, author, uniqueSlug, latestPublishedAt } = publication;
25+
const avatar = avatars[author.toLowerCase()];
1526
return (
1627
<a href={uniqueSlug} className={styles["publication-card"]}>
1728
<section>
18-
{/* TODO map avatars */}
19-
<div className={styles["publication-card--avatar"]}>
20-
{author.slice(0, 1).toUpperCase()}
29+
<div
30+
className={styles["publication-card--avatar"]}
31+
style={
32+
avatar
33+
? {
34+
backgroundImage: `url(${avatar})`,
35+
}
36+
: {}
37+
}
38+
>
39+
{avatar ? "" : author.slice(0, 1).toUpperCase()}
2140
</div>
2241
<div>
2342
<p className={styles["publication-card--author"]}>{author}</p>

0 commit comments

Comments
 (0)