This repository has no description
1{{ define "fragments/comment/reply" }}
2 <form
3 class="p-2 group w-full border-t border-gray-200 dark:border-gray-700 flex flex-col gap-2"
4 hx-post="/comment"
5 hx-swap="none"
6 hx-trigger="submit, keydown[(ctrlKey || metaKey) && key=='Enter'] from:find textarea"
7 hx-on::before-request="this.querySelector('#comment-error').innerHTML = ''"
8 hx-disabled-elt="find button[type='submit']"
9 >
10 {{ template "user/fragments/picHandleLink" .LoggedInUser.Did }}
11 <textarea
12 name="body"
13 class="w-full p-2"
14 placeholder="Leave a reply..."
15 autofocus
16 rows="3"></textarea>
17 {{ template "replyActions" . }}
18 </form>
19{{ end }}
20
21{{ define "replyActions" }}
22 <div class="flex flex-wrap items-stretch justify-end gap-2 text-gray-500 dark:text-gray-400">
23 <div id="comment-error" class="error ml-auto"></div>
24 {{ template "cancel" . }}
25 {{ template "reply" . }}
26 </div>
27{{ end }}
28
29{{ define "cancel" }}
30 <button
31 class="btn-flat text-red-500 dark:text-red-400 flex gap-2 items-center group"
32 hx-get="/comment/reply/placeholder"
33 hx-target="closest form"
34 hx-swap="outerHTML"
35 >
36 {{ i "x" "size-4" }}
37 Cancel
38 </button>
39{{ end }}
40
41{{ define "reply" }}
42 <button
43 type="submit"
44 class="btn-create-flat flex items-center gap-2 no-underline hover:no-underline"
45 >
46 {{ i "reply" "w-4 h-4 inline group-[.htmx-request]:hidden" }}
47 {{ i "loader-circle" "w-4 h-4 animate-spin hidden group-[.htmx-request]:inline" }}
48 Reply
49 </button>
50{{ end }}