-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSidebar.jsx
More file actions
43 lines (40 loc) · 1.38 KB
/
Sidebar.jsx
File metadata and controls
43 lines (40 loc) · 1.38 KB
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
import { Icon } from "./icons";
const sidebarItems = [
{ label: "Location", valueKey: "location", hrefKey: null, icon: "pin" },
{ label: "Institution", valueKey: "institution", hrefKey: null, icon: "building" },
{ label: "Email", valueKey: null, hrefKey: "email", icon: "mail" },
{ label: "ORCID", valueKey: null, hrefKey: "orcid", icon: "id" },
{ label: "GitHub", valueKey: null, hrefKey: "github", icon: "code" },
{ label: "LinkedIn", valueKey: null, hrefKey: "linkedin", icon: "linkedin" },
];
export function Sidebar({ siteData }) {
return (
<aside className="sidebar">
<img
className="profile-image"
src={siteData.profileImage}
alt={`${siteData.name} profile`}
/>
<h1>{siteData.name}</h1>
<p className="sidebar-bio">{siteData.bio}</p>
<ul className="sidebar-links">
{sidebarItems.map((item) => {
const href = item.hrefKey ? siteData.links[item.hrefKey] : null;
const text = item.valueKey ? siteData[item.valueKey] : item.label;
return (
<li key={item.label}>
<Icon name={item.icon} />
{href ? (
<a href={href} target="_blank" rel="noreferrer">
{text}
</a>
) : (
<span>{text}</span>
)}
</li>
);
})}
</ul>
</aside>
);
}