summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorGrail Finder (aider) <wohilas@gmail.com>2025-03-29 14:40:08 +0300
committerGrail Finder (aider) <wohilas@gmail.com>2025-03-29 14:40:08 +0300
commit8e9c2e827da72980f9efb3bb6859a289f930119a (patch)
tree9353398bab3cd280605589bc11f746e9fd0ab76c /components
parentb276143b38c6e273126918fd92b5903a6293b1d9 (diff)
feat: add interactive option buttons with HTMX
Diffstat (limited to 'components')
-rw-r--r--components/index.html12
1 files changed, 11 insertions, 1 deletions
diff --git a/components/index.html b/components/index.html
index 0e58af2..5626dbd 100644
--- a/components/index.html
+++ b/components/index.html
@@ -14,7 +14,17 @@
{{.Text}}
</div>
<div>
- <!-->here we need to iterate through {{.Options}} and make them selectable; ai!<-->
+ {{range $index, $option := .Options}}
+ <button
+ hx-post="/answer"
+ hx-vals='{"selected": "{{$index}}"}'
+ hx-target="#ancestor"
+ hx-swap="outerHTML"
+ class="option-button"
+ >
+ {{$option}}
+ </button>
+ {{end}}
</div>
</div>
</body>