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