-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.html
80 lines (77 loc) · 3.11 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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Chirper</title>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=5.0, minimum-scale=1.0" />
<script
defer
src="https://unpkg.com/@livefir/fir@latest/dist/fir.min.js"></script>
<script
defer
src="https://unpkg.com/[email protected]/dist/cdn.min.js"></script>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@exampledev/[email protected]/new.min.css" />
</head>
<body>
<div x-data="{ disable: false }">
<h1>Chirper</h1>
<hr />
<p>
{{ fir.Error "onload" }}
</p>
<form
method="post"
action="/?event=create-chirp"
@submit.prevent="$fir.submit()"
@fir:create-chirp:ok.nohtml="$el.reset()"
@fir:[create-chirp:pending,create-chirp:done]="disable = !disable">
<!-- prettier-ignore -->
<textarea type="text" name="body" placeholder="a new chirp" rows="4" cols="100"></textarea>
<p @fir:create-chirp:error="$fir.replace()">
{{ fir.Error "create-chirp.body" }}
</p>
<footer>
<button :disabled="disable" type="submit">Chirp</button>
</footer>
</form>
<hr />
<div @fir:create-chirp:ok::chirp="$fir.prependEl()">
{{ range .chirps }}
{{ block "chirp" . }}
<section
fir-key="{{ .ID }}"
@fir:delete-chirp:ok.nohtml="$fir.removeEl()">
<form method="post" @submit.prevent="$fir.submit()">
<blockquote>
{{ .Body }}
</blockquote>
<input
type="hidden"
name="chirpID"
value="{{ .ID }}" />
<footer>
<button
@fir:like-chirp:ok="$fir.replace()"
formaction="/?event=like-chirp"
type="submit">
♥
{{ .LikesCount }}
</button>
<button
formaction="/?event=delete-chirp"
type="submit">
✕
</button>
</footer>
</form>
</section>
{{ end }}
{{ end }}
</div>
</div>
</body>
</html>