summaryrefslogtreecommitdiff
path: root/sw-ui-kt/src/main/kotlin/org
diff options
context:
space:
mode:
authorJoffrey Bion <joffrey.bion@booking.com>2020-03-22 23:05:44 +0100
committerJoffrey Bion <joffrey.bion@booking.com>2020-03-22 23:05:44 +0100
commit55d538554b952fd63659b63839df0f72b1795da3 (patch)
tree7a87fcdc1031e025ac6367ea2ab7b78d081a9116 /sw-ui-kt/src/main/kotlin/org
parentFix player order by adding placeholders before shifting (diff)
downloadseven-wonders-55d538554b952fd63659b63839df0f72b1795da3.tar.gz
seven-wonders-55d538554b952fd63659b63839df0f72b1795da3.tar.bz2
seven-wonders-55d538554b952fd63659b63839df0f72b1795da3.zip
Fix home refresh on enter key
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