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 val will serve a basic HTML wordle game with very colorful and animated CSS.
// It will be entirely static. For a more interactive version, you would need a backend to handle game logic.
/**
* @jsxImportSource https://esm.sh/react@17.0.2
*/
import { html } from "https://esm.town/v/stevekrouse/html";
const WebPage = () => (
<html>
<head>
<style>
{`
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background: linear-gradient(135deg, #f27373, #f5ad1b);
font-family: 'Comic Sans MS', cursive, sans-serif;
color: white;
animation: backgroundAnimation 5s ease infinite;
}
@keyframes backgroundAnimation {
0% { background-color: #f27373; }
50% { background-color: #f5ad1b; }
100% { background-color: #f27373; }
}
#wordle {
display: grid;
grid-template-columns: repeat(5, 45px);
grid-gap: 5px;
}
.letter {
width: 40px;
height: 40px;
background-color: #333;
display: flex;
justify-content: center;
align-items: center;
font-size: 1.5em;
border-radius: 10px;
animation: pop 0.3s ease-in-out;
}
@keyframes pop {
0% { transform: scale(0.8); }
100% { transform: scale(1); }
}
`}
</style>
<script>
{`
let word = "CRANE"; // Change this for different words
let currentRow = 0;
const rows = [['', '', '', '', ''], ['', '', '', '', ''], ['', '', '', '', ''], ['', '', '', '', ''], ['', '', '', '', ''], ['', '', '', '', '']];
function updateBoard() {
let html = '';
for (row of rows) {
for (cell of row) {
html += '<div class="letter">' + cell + '</div>';
}
}
document.getElementById('wordle').innerHTML = html;
}
document.addEventListener('keydown', (event) => {
const key = event.key.toUpperCase();
if (key === 'ENTER') {
currentRow++;
return;
} else if (key === 'BACKSPACE') {
rows[currentRow] = rows[currentRow].slice(0, -1);
} else if (key.match(/^[A-Z]$/)) {
if (rows[currentRow].length < 5) {
rows[currentRow].push(key);
}
}
updateBoard();
});
updateBoard();
`}
</script>
</head>
<body>
<div id="wordle"></div>
</body>
</html>
);
export default function main(): Response {
return html(<WebPage />);
}