diff options
-rw-r--r-- | sw-ui-kt/src/main/kotlin/org/luxons/sevenwonders/ui/components/home/ChooseNameForm.kt | 6 |
1 files changed, 5 insertions, 1 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 30a0883a..11f52529 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 @@ -16,10 +16,14 @@ private interface ChooseNameFormProps: RProps { var chooseUsername: (String) -> Unit } -private data class ChooseNameFormState(val username: String): RState +private data class ChooseNameFormState(var username: String = ""): RState private class ChooseNameForm(props: ChooseNameFormProps): RComponent<ChooseNameFormProps, ChooseNameFormState>(props) { + override fun ChooseNameFormState.init(props: ChooseNameFormProps) { + username = "" + } + override fun RBuilder.render() { form { attrs.onSubmitFunction = { props.chooseUsername(state.username) } |