-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
67 lines (50 loc) · 2.05 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
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<title>Small memory game</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/normalize.css">
<script src="https://cdn.tailwindcss.com"></script>
<meta name="theme-color" content="#fafafa">
<script src="//unpkg.com/alpinejs" defer></script>
</head>
<body>
<div x-data="game()" class="px-10 py-4 flex items-center justify-center min-h-screen">
<h1 class="fixed w-full flex top-0 right-0 px-4 font-bold text-3xl justify-between items-center">
<div class="text-2xl">
<span x-text="points"></span>
<span class="">pts</span>
</div>
<div>
<button @click="reset()"
class="border border-red-500 bg-red-500 text-white rounded-md px-4 py-2 m-2 transition duration-500 ease select-none hover:bg-red-600 focus:outline-none focus:shadow-outline">
Reset
</button>
</div>
</h1>
<div class="grid gap-2 grid-cols-2 md:grid-cols-6">
<template x-for="card in cards">
<div class="h-32 bg-gray-300 w-32 cursor-pointer flex"
:style="'background:' + (card.flipped ? card.color : '#ddd')"
@click="flipCard(card)">
<div x-show="card.cleared"
class="w-full text-4xl font-bold"
style="text-align: center;align-self: center">✔
</div>
</div>
</template>
</div>
</div>
<div x-data="{message: '-', show:false}"
x-show="show"
@flash.window="message = $event.detail.message; show = true; setTimeout(() => show=false,1000)"
class="fixed bottom-0 right-0 text-white bg-blue-500 p-2 mb-4 mr-4 rounded">
<span x-text="message" class="pr-4"></span>
<button @click="show = false">×</button>
</div>
<script src="js/vendor/modernizr-3.11.2.min.js"></script>
<script src="js/main.js"></script>
</body>
</html>