summaryrefslogtreecommitdiff
path: root/sw-ui-kt/src/main/kotlin/org
diff options
context:
space:
mode:
Diffstat (limited to 'sw-ui-kt/src/main/kotlin/org')
-rw-r--r--sw-ui-kt/src/main/kotlin/org/luxons/sevenwonders/ui/components/home/ChooseNameForm.kt10
1 files changed, 8 insertions, 2 deletions
diff --git a/sw-ui-kt/src/main/kotlin/org/luxons/sevenwonders/ui/components/home/ChooseNameForm.kt b/sw-ui-kt/src/main/kotlin/org/luxons/sevenwonders/ui/components/home/ChooseNameForm.kt
index 94058131..91f6e291 100644
--- a/sw-ui-kt/src/main/kotlin/org/luxons/sevenwonders/ui/components/home/ChooseNameForm.kt
+++ b/sw-ui-kt/src/main/kotlin/org/luxons/sevenwonders/ui/components/home/ChooseNameForm.kt
@@ -8,6 +8,7 @@ import kotlinx.html.js.onSubmitFunction
import org.luxons.sevenwonders.ui.redux.RequestChooseName
import org.luxons.sevenwonders.ui.redux.connectDispatch
import org.w3c.dom.HTMLInputElement
+import org.w3c.dom.events.Event
import react.RBuilder
import react.RClass
import react.RComponent
@@ -30,7 +31,7 @@ private class ChooseNameForm(props: ChooseNameFormProps): RComponent<ChooseNameF
override fun RBuilder.render() {
form {
- attrs.onSubmitFunction = { props.chooseUsername(state.username) }
+ attrs.onSubmitFunction = { e -> chooseUsername(e) }
inputGroup(
large = true,
placeholder = "Username",
@@ -48,9 +49,14 @@ private class ChooseNameForm(props: ChooseNameFormProps): RComponent<ChooseNameF
minimal = true,
icon = "arrow-right",
intent = Intent.PRIMARY,
- onClick = { props.chooseUsername(state.username) }
+ onClick = { e -> chooseUsername(e) }
)
}
+
+ private fun chooseUsername(e: Event) {
+ e.preventDefault()
+ props.chooseUsername(state.username)
+ }
}
val chooseNameForm: RClass<RProps> = connectDispatch(ChooseNameForm::class) { dispatch, _ ->
bgstack15