this repo has no description
1{{ define "repo/fragments/reactions" }}
2 <div class="flex flex-wrap items-center gap-2">
3 {{- $reactions := .Reactions -}}
4 {{- $userReacted := .UserReacted -}}
5 {{- $threadAt := .ThreadAt -}}
6
7 {{ template "reactionsPopup" }}
8 {{ range $kind := const.OrderedReactionKinds }}
9 {{ $reactionData := index $reactions $kind }}
10 {{ template "repo/fragments/reaction"
11 (dict
12 "Kind" $kind
13 "Count" $reactionData.Count
14 "IsReacted" (index $userReacted $kind)
15 "ThreadAt" $threadAt
16 "Users" $reactionData.Users) }}
17 {{ end }}
18 </div>
19{{ end }}
20
21{{ define "reactionsPopup" }}
22 <details
23 id="reactionsPopUp"
24 class="relative inline-block"
25 >
26 <summary
27 class="flex justify-center items-center min-w-8 min-h-8 rounded border border-gray-200 dark:border-gray-700
28 hover:bg-gray-50
29 hover:border-gray-300
30 dark:hover:bg-gray-700
31 dark:hover:border-gray-600
32 cursor-pointer list-none"
33 >
34 {{ i "smile" "size-4" }}
35 </summary>
36 <div
37 class="absolute flex left-0 z-10 mt-4 rounded bg-white dark:bg-gray-800 dark:text-white border border-gray-200 dark:border-gray-700 shadow-lg"
38 >
39 {{ range $kind := const.OrderedReactionKinds }}
40 <button
41 id="reactBtn-{{ $kind }}"
42 class="size-12 hover:bg-gray-100 dark:hover:bg-gray-700"
43 hx-on:click="this.parentElement.parentElement.removeAttribute('open')"
44 >
45 {{ $kind }}
46 </button>
47 {{ end }}
48 </div>
49 </details>
50{{ end }}