forked from giuseppefigliuolo/little-printer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
206 lines (203 loc) · 6.5 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
rel="icon"
href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>📪</text></svg>"
/>
<title>Little Printer Club</title>
<link
href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css"
rel="stylesheet"
/>
<script src="//unpkg.com/alpinejs" defer></script>
</head>
<body x-data="publicationsData()" x-init="init()">
<canvas class="webgl"></canvas>
<main class="bg-white mx-auto" style="width: 425px">
<div class="mx-auto">
<div class="flex flex-col image cursor-pointer">
<template x-for="publication in publications">
<div
class="
bg-white
px-4
py-5
sm:px-6
border-b border-gray-200
hover:bg-gray-100 hover:rounded-lg
"
@click="open = true; modalPub = publication"
>
<div class="flex space-x-3">
<div class="flex-shrink-0">
<img
class="h-10 w-10 rounded object-cover"
src="https://cataas.com/cat"
/>
</div>
<div class="min-w-0 flex-1">
<p class="text-sm font-medium text-gray-900">
<a class="hover:underline" x-text="publication.name"
>Chelsea Hagon</a
>
</p>
<p class="text-sm text-gray-500">
<a class="hover:underline" x-text="publication.author"></a>
</p>
</div>
</div>
</div>
</template>
<div class="py-8"></div>
</div>
<div class="bottom"></div>
</div>
</main>
<div
@keydown.window.escape="open = false"
x-init='$watch("open", o => !o)'
x-show="open"
class="fixed z-10 inset-0 overflow-y-auto"
x-ref="dialog"
>
<div
class="
flex
items-end
justify-center
min-h-screen
pt-4
px-4
pb-20
text-center
sm:block sm:p-0
"
>
<div
x-show="open"
x-transition:enter="ease-out duration-300"
x-transition:enter-start="opacity-0"
x-transition:enter-end="opacity-100"
x-transition:leave="ease-in duration-200"
x-transition:leave-start="opacity-100"
x-transition:leave-end="opacity-0"
x-description="Background overlay, show/hide based on modal state."
class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity"
@click="open = false"
aria-hidden="true"
></div>
<!-- This element is to trick the browser into centering the modal contents. -->
<span
class="hidden sm:inline-block sm:align-middle sm:h-screen"
aria-hidden="true"
></span
>
<div
x-show="open"
x-transition:enter="ease-out duration-300"
x-transition:enter-start="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
x-transition:enter-end="opacity-100 translate-y-0 sm:scale-100"
x-transition:leave="ease-in duration-200"
x-transition:leave-start="opacity-100 translate-y-0 sm:scale-100"
x-transition:leave-end="opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
x-description="Modal panel, show/hide based on modal state."
class="
inline-block
align-bottom
bg-white
rounded-lg
px-4
pt-5
pb-4
text-left
overflow-hidden
shadow-xl
transform
transition-all
sm:my-8 sm:align-middle sm:max-w-sm sm:w-full sm:p-6
"
>
<div>
<div class="mt-3 sm:mt-5">
<div class="bg-white px-4 pb-5 sm:px-6">
<div class="flex space-x-3">
<div class="flex-shrink-0">
<img
class="h-10 w-10 rounded object-cover"
src="https://cataas.com/cat"
/>
</div>
<div class="min-w-0 flex-1">
<p class="text-sm font-medium text-gray-900">
<a class="hover:underline" x-text="modalPub.name"
>Chelsea Hagon</a
>
</p>
<p class="text-sm text-gray-500">
<a class="hover:underline" x-text="modalPub.author"></a>
</p>
</div>
</div>
</div>
<div class="mt-2">
<img :src="modalPub.preview" class="mx-auto w-full" />
</div>
</div>
</div>
<div class="mt-5 sm:mt-6">
<button
type="button"
class="
inline-flex
justify-center
w-full
rounded-md
border border-transparent
shadow-sm
px-4
py-2
bg-indigo-600
text-base
font-medium
text-white
hover:bg-indigo-700
focus:outline-none
focus:ring-2
focus:ring-offset-2
focus:ring-indigo-500
sm:text-sm
"
@click="open = false"
>
Stampa
</button>
</div>
</div>
</div>
</div>
<canvas id="drawing-canvas" height="128" width="128"></canvas>
<script type="module" src="./main.js"></script>
<script src="./sparkles.js"></script>
<script>
function publicationsData() {
return {
title: 'Publications',
publications: [],
modalPub: null,
open: false,
init() {
fetch('publications.json')
.then((response) => response.json())
.then((response) => {
let publications = response
this.publications = publications
})
}
}
}
</script>
</body>
</html>