|
|
|
|
@ -1,21 +1,31 @@
|
|
|
|
|
routeKeyToFocused = state event \
|
|
|
|
|
(state.focusedInput == "email"
|
|
|
|
|
| True \
|
|
|
|
|
newInputState = textInput2.update state.email event;
|
|
|
|
|
newInputState = textInput.update state.email event;
|
|
|
|
|
state.{ email = newInputState }
|
|
|
|
|
| False \
|
|
|
|
|
newInputState = textInput2.update state.password event;
|
|
|
|
|
newInputState = textInput.update state.password event;
|
|
|
|
|
state.{ password = newInputState });
|
|
|
|
|
|
|
|
|
|
init = {
|
|
|
|
|
focusedInput = "email",
|
|
|
|
|
email = textInput2.init "",
|
|
|
|
|
password = textInput2.init ""
|
|
|
|
|
email = textInput.init "",
|
|
|
|
|
password = textInput.init ""
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
update = state event \ event
|
|
|
|
|
| FocusEmail \ state.{ focusedInput = "email" }
|
|
|
|
|
| FocusPassword \ state.{ focusedInput = "password" }
|
|
|
|
|
| FocusEmail coords \ (
|
|
|
|
|
newState = state.{ focusedInput = "email" };
|
|
|
|
|
newInputState = textInput.update state.email (Clicked coords);
|
|
|
|
|
newState.{ email = newInputState }
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
| FocusPassword coords \ (
|
|
|
|
|
newState = state.{ focusedInput = "password" };
|
|
|
|
|
newInputState = textInput.update state.password (Clicked coords);
|
|
|
|
|
newState.{ password = newInputState }
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
| ArrowLeft \ routeKeyToFocused state ArrowLeft
|
|
|
|
|
| ArrowRight \ routeKeyToFocused state ArrowRight
|
|
|
|
|
| Backspace \ routeKeyToFocused state Backspace
|
|
|
|
|
@ -29,13 +39,13 @@ view = state viewport \
|
|
|
|
|
child = Column {
|
|
|
|
|
gap = 10,
|
|
|
|
|
children = [
|
|
|
|
|
textInput2.view state.email {
|
|
|
|
|
textInput.view state.email {
|
|
|
|
|
focused = state.focusedInput == "email",
|
|
|
|
|
onFocus = FocusEmail,
|
|
|
|
|
w = 300,
|
|
|
|
|
h = 40
|
|
|
|
|
},
|
|
|
|
|
textInput2.view state.password {
|
|
|
|
|
textInput.view state.password {
|
|
|
|
|
focused = state.focusedInput == "password",
|
|
|
|
|
onFocus = FocusPassword,
|
|
|
|
|
w = 300,
|
|
|
|
|
|