Monorepo for Tangled tangled.org
at master 921 B view raw
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 13 hx-trigger="click" 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 {{ .StarCount }} 23 </span> 24 {{ i "loader-circle" "w-4 h-4 animate-spin hidden group-[.htmx-request]:inline" }} 25 </button> 26{{ end }}