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