this repo has no description
1{{ define "fragments/starBtn" }}
2 <button
3 id="starBtn"
4 class="btn disabled:opacity-50 disabled:cursor-not-allowed flex gap-2 items-center group"
5 data-star-subject-at="{{ .SubjectAt }}"
6 {{ if .IsStarred }}
7 hx-delete="/star?subject={{ .SubjectAt }}&countHint={{ .StarCount }}"
8 {{ else }}
9 hx-post="/star?subject={{ .SubjectAt }}&countHint={{ .StarCount }}"
10 {{ end }}
11
12 hx-trigger="click"
13 hx-target="this"
14 hx-swap="outerHTML"
15 hx-swap-oob='outerHTML:#starBtn[data-star-subject-at="{{ .SubjectAt }}"]'
16 hx-disabled-elt="#starBtn"
17 >
18 {{ if .IsStarred }}
19 {{ i "star" "w-4 h-4 fill-current" }}
20 {{ else }}
21 {{ i "star" "w-4 h-4" }}
22 {{ end }}
23 <span class="text-sm">
24 {{ .StarCount }}
25 </span>
26 {{ i "loader-circle" "w-4 h-4 animate-spin hidden group-[.htmx-request]:inline" }}
27 </button>
28{{ end }}