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
/** @jsxImportSource https://esm.sh/react */
import React from "https://esm.sh/react";
const pulseKeyframes = `
@keyframes pulse {
0% {
transform: translate(-50%, -50%) scale(1);
box-shadow: 0 10px 20px rgba(214, 40, 40, 0.3);
}
50% {
transform: translate(-50%, -50%) scale(1.13);
box-shadow: 0 15px 30px rgba(214, 40, 40, 0.4);
}
100% {
transform: translate(-50%, -50%) scale(1);
box-shadow: 0 10px 20px rgba(214, 40, 40, 0.3);
}
}
`;
export default async function server(request: Request): Promise<Response> {
return new Response(
`
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Red Ball Component</title>
<script src="https://unpkg.com/react@17/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@17/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
<style>
body {
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
overflow: hidden;
}
${pulseKeyframes}
</style>
</head>
<body>
<div id="root"></div>
<script type="text/babel">
function RedBall() {
return (
<div
style={{
width: "200px",
height: "200px",
borderRadius: "50%",
background: "radial-gradient(circle at 30% 30%, #FF4040, #B80000)",
boxShadow: "0 10px 20px rgba(214, 40, 40, 0.3)",
position: "absolute",
top: "50%",
left: "50%",
transform: "translate(-50%, -50%)",
animation: "pulse 2s infinite ease-in-out",
}}
/>
);
}
ReactDOM.render(<RedBall />, document.getElementById('root'));
</script>
</body>
</html>
`,
{
headers: { "Content-Type": "text/html" },
}
);
}