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
/**
* This script creates a minimalist homepage with a beautiful, animated gradient background.
* It features a central business card for Carl Lange with a 3D flip animation on click.
* The front of the card displays Carl's name and an animated subheading, while the back shows a humorous message and links.
*/
/** @jsxImportSource https://esm.sh/react */
import React, { useEffect, useState } from "https://esm.sh/react";
import { createRoot } from "https://esm.sh/react-dom/client";
function App() {
const subheadings = [
"doing this for fun",
"Donald Duck is my spirit animal",
"🤙🤙🤙🤙🤙🤙🤙🤙",
"talks a good game",
"rather be playing tennis",
"hey, this isn't a bouldering gym!",
"should be outside",
"an AI wrote these",
];
const [currentSubheading, setCurrentSubheading] = useState(0);
const [isFlipped, setIsFlipped] = useState(false);
useEffect(() => {
// Shuffle the subheadings array
for (let i = subheadings.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[subheadings[i], subheadings[j]] = [subheadings[j], subheadings[i]];
}
const interval = setInterval(() => {
setCurrentSubheading((prev) => (prev + 1) % subheadings.length);
}, 3000);
return () => clearInterval(interval);
}, []);
const handleClick = () => {
setIsFlipped(!isFlipped);
};
return (
<div className="scene">
<div className="card-container">
<div className={`card ${isFlipped ? "is-flipped" : ""}`} onClick={handleClick}>
<div className={`card__face card__face--front ${!isFlipped ? "face-visible" : ""}`}>
<h1>
<a href="mailto:carl@flax.ie" onClick={(e) => e.stopPropagation()}>Carl Lange</a>
</h1>
<h2 className="animated-subheading">{subheadings[currentSubheading]}</h2>
</div>
<div className={`card__face card__face--back ${isFlipped ? "face-visible" : ""}`}>
<p>If I were a more interesting man, I'd have more links here</p>
<a href="https://toughsoles.ie" className="back-link" onClick={(e) => e.stopPropagation()}>toughsoles.ie</a>
<a
href={import.meta.url.replace("esm.town", "val.town")}
className="view-source"
onClick={(e) => e.stopPropagation()}
>
view source on val.town
</a>
</div>
</div>
</div>
</div>
);
}
function client() {
createRoot(document.getElementById("root")).render(<App />);
}
if (typeof document !== "undefined") { client(); }
async function server(request: Request): Promise<Response> {
return new Response(
`
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Carl Lange | redfloatplane.lol</title>
<style>${css}</style>
</head>
<body>
<div id="root"></div>
<script type="module" src="${import.meta.url}"></script>
</body>
</html>
`,
{
headers: {
"content-type": "text/html",
},
},
);
}