add "clear" button.

This commit is contained in:
fiatjaf 2023-04-25 22:06:04 -03:00
parent ed16607a36
commit b1d9c9d5bf
No known key found for this signature in database
GPG Key ID: BAD43C4BE5C1A3A1

View File

@ -45,6 +45,15 @@ object Main extends IOWebApp {
def actions(store: Store): Resource[IO, HtmlDivElement[IO]] = def actions(store: Store): Resource[IO, HtmlDivElement[IO]] =
div( div(
cls := "flex flex-col space-y-1 my-3", cls := "flex flex-col space-y-1 my-3",
store.input.map {
case "" => div("")
case _ =>
button(
Styles.button,
"clear",
onClick --> (_.foreach(_ => store.input.set("")))
)
},
store.result.map { store.result.map {
case Right(_: Event) => case Right(_: Event) =>
button( button(