Files
rose-ash/sx/sxc/reference/ref-optimistic-demo.sx
giles a7da235459 SXC content: docs/examples/home/reference pages + SX testing runner
New sxc/ content tree with 120 page files across docs, examples, home,
and reference demos. sx/sx/testing/ adds page-runner.sx (317L) and
index-runner.sx (394L) — SX-native test runner pages for
browser-based evaluation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-22 09:08:47 +00:00

30 lines
1.1 KiB
Plaintext

(defcomp
()
(div
(~tw :tokens "space-y-2")
(div
:id "ref-opt-item-1"
(~tw :tokens "flex items-center justify-between p-2 border border-stone-200 rounded")
(span (~tw :tokens "text-sm text-stone-700") "Optimistic item A")
(button
:sx-delete "/sx/(geography.(hypermedia.(reference.(api.(item.opt1)))))"
:sx-target "#ref-opt-item-1"
:sx-swap "delete"
:sx-optimistic "remove"
(~tw :tokens "text-red-500 text-sm hover:text-red-700")
"Remove"))
(div
:id "ref-opt-item-2"
(~tw :tokens "flex items-center justify-between p-2 border border-stone-200 rounded")
(span (~tw :tokens "text-sm text-stone-700") "Optimistic item B")
(button
:sx-delete "/sx/(geography.(hypermedia.(reference.(api.(item.opt2)))))"
:sx-target "#ref-opt-item-2"
:sx-swap "delete"
:sx-optimistic "remove"
(~tw :tokens "text-red-500 text-sm hover:text-red-700")
"Remove"))
(p
(~tw :tokens "text-xs text-stone-400")
"Items fade out immediately on click (optimistic), then are removed when the server responds.")))