This repository has been archived by the owner on Apr 18, 2024. It is now read-only.
/
home.js
140 lines (134 loc) · 3.78 KB
/
home.js
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
const { Fragment } = require("react");
const { jsx } = require("@emotion/core");
const { Title, Description } = require("./lead");
const Header = require("./header");
const Patreon = require("./patreon");
const Twitter = require("./icons/twitter");
const Meetup = require("./icons/meetup");
const NPM = require("./icons/npm");
const GitHub = require("./icons/github");
const Dev = require("./icons/dev");
const LinkedIn = require("./icons/linkedin");
const Email = require("./icons/email");
function formatURL({ name, value }) {
switch (name.toLowerCase()) {
case "twitter":
return { icon: Twitter, link: `https://twitter.com/${value}` };
case "meetup":
return {
icon: Meetup,
link: `https://www.meetup.com/members/${value}/`
};
case "npm":
return { icon: NPM, link: `https://www.npmjs.com/~${value}` };
case "github":
return { icon: GitHub, link: `https://github.com/${value}` };
case "dev":
return { icon: Dev, link: `https://dev.to/${value}` };
case "linkedin":
return { icon: LinkedIn, link: `https://www.linkedin.com/in/${value}/` };
default:
return null;
}
}
const Icon = props =>
jsx(
"i",
{
...props,
css: {
svg: {
width: "32px",
height: "32px",
fill: "black",
"@media (max-width: 1000px) and (orientation: portrait)": {
width: "20px",
height: "20px"
},
"@media (prefers-color-scheme: dark)": { fill: "white" }
}
}
},
props.children
);
function HomePage({ config = {} } = {}) {
return jsx(
Fragment,
null,
jsx(Header, { ...config }),
jsx(
"section",
{
css: {
boxSizing: "border-box",
fontSize: "1.25em",
minHeight: "calc(90vh - 58px)",
margin: "10vh auto 0",
maxWidth: "1000px",
padding: "0 10vw 0",
"@media (max-width: 1000px)": {
fontSize: "1em"
},
"@media (max-width: 1000px) and (orientation: landscape)": {
marginBottom: "10vh"
}
}
},
jsx(Title, null, config.title),
jsx(Description, null, config.description),
jsx(
"div",
null,
config.social &&
Object.entries(config.social).map(([name, value]) =>
jsx(
"a",
{
key: name,
href: formatURL({ name, value }).link,
title: name,
css: {
display: "inline-flex",
color: "black",
textDecoration: "none",
margin: "0 .5em",
":first-of-type": {
marginLeft: 0
},
":last-of-type": {
marginRight: 0
},
"@media (prefers-color-scheme: dark)": { color: "white" }
}
},
jsx(Icon, null, jsx(formatURL({ name, value }).icon))
)
),
config.email &&
jsx(
"a",
{
href: `mailto:${config.email}`,
css: {
display: "inline-flex",
color: "black",
textDecoration: "none",
margin: "0 .5em",
":first-of-type": {
marginLeft: 0
},
":last-of-type": {
marginRight: 0
},
"@media (prefers-color-scheme: dark)": { color: "white" }
}
},
jsx(Icon, null, jsx(Email))
)
),
config.patreon && jsx("br"),
config.patreon && jsx(Patreon, { name: config.patreon })
)
);
}
module.exports = HomePage;