Initial support for JS commands

This commit is contained in:
Paul-Henri Froidmont 2025-09-16 03:16:50 +02:00
parent d42472061b
commit 6f012b6796
Signed by: phfroidmont
GPG key ID: BE948AFD7E7873BE
4 changed files with 62 additions and 5 deletions

View file

@ -4,8 +4,8 @@ import zio.stream.ZStream
class HomeLiveView() extends LiveView[String, Unit]:
val links = List(
"/counter" -> "Counter",
"/list" -> "List"
"/counter" -> "Counter",
"/list?q=test" -> "List"
)
def init = ZIO.succeed(())

View file

@ -54,7 +54,11 @@ class ListLiveView(someParam: String) extends LiveView[Msg, Model]:
phx.click := Msg.IncAge(1),
"Inc age"
),
span(cls := "grow")
span(cls := "grow"),
button(
phx.click := JS.toggleClass("bg-red-500 border-5"),
"Toggle color"
)
)
)