-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
140 lines (138 loc) · 3.94 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta
name="description"
content="A simple Simon says game made with Alpine.js"
/>
<title>Simon says</title>
</head>
<body>
<h1 class="sr-only">Simon Says</h1>
<div
x-data="game"
class="min-h-screen flex flex-col items-center justify-center gap-10"
>
<div class="relative">
<div class="absolute inset-0 flex items-center justify-center">
<button
x-show="!running"
class="
bg-black
text-white
rounded-full
px-4
py-1
w-40
h-40
sm:w-64 sm:h-64
md:w-72 md:h-72
z-20
text-2xl
font-bold
tracking-wide
"
@click="startGame()"
>
Start Game
</button>
</div>
<div
class="grid grid-cols-2 gap-2 sm:gap-4 md:gap-8 rotate-45"
:class="{'opacity-50': !running}"
>
<button
class="
w-36
h-36
sm:w-60 sm:h-60
md:w-64 md:h-64
rounded-tl-full
disabled:cursor-not-allowed
"
:class="{'bg-yellow-200': isActive('top'), 'bg-yellow-400': !isActive('top')}"
:disabled="blocked"
@click="enter('top')"
>
<span class="sr-only">Top</span>
</button>
<button
class="
w-36
h-36
sm:w-60 sm:h-60
md:w-64 md:h-64
rounded-tr-full
disabled:cursor-not-allowed
"
:class="{'bg-blue-200': isActive('right'), 'bg-blue-600': !isActive('right')}"
:disabled="blocked"
@click="enter('right')"
>
<span class="sr-only">Right</span>
</button>
<button
class="
w-36
h-36
sm:w-60 sm:h-60
md:w-64 md:h-64
rounded-bl-full
disabled:cursor-not-allowed
"
:class="{'bg-red-200': isActive('left'), 'bg-red-500': !isActive('left')}"
:disabled="blocked"
@click="enter('left')"
>
<span class="sr-only">Left</span>
</button>
<button
class="
w-36
h-36
sm:w-60 sm:h-60
md:w-64 md:h-64
rounded-br-full
disabled:cursor-not-allowed
"
:class="{'bg-green-200': isActive('bottom'), 'bg-green-500': !isActive('bottom')}"
:disabled="blocked"
@click="enter('bottom')"
>
<span class="sr-only">Bottom</span>
</button>
</div>
</div>
<div class="text-xl font-bold">
<div x-show="lost">
You lost the game after <span x-text="wonRounds"></span> rounds!
</div>
<div x-show="!lost">Current round: <span x-text="round"></span></div>
</div>
<footer class="fixed bottom-4 w-full text-center">
<p>
Made by
<a
href="https://github.com/npostulart"
class="text-blue-700 hover:underline"
>Niklas Postulart</a
>
with <span class="mr-1">💪</span>,
<a
href="https://tailwindcss.com/"
class="text-blue-700 hover:underline"
>tailwindcss</a
>
and
<a href="https://alpinejs.dev/" class="text-blue-700 hover:underline"
>Alpine.js</a
>
</p>
</footer>
</div>
<script type="module" src="/main.js"></script>
</body>
</html>