[sc-50634] Erumu: Make a Way to Set a Custom Type on TextInput - #28
Conversation
| , HTML.value m.currentValue | ||
| ] | ||
| in | ||
| input (ourProps <> disabledProp m.disabled <> userProps) [] |
There was a problem hiding this comment.
This duplicates the rendering logic from render. An the very least render should call this function. It would be even better if the widget took the input type as part of init so that we don't even need separate render functions.
I also have some amount of discomfort with the fact that you can put any old input type in here (e.g. "checkbox") when the widgets are really designed around hiding that from you. It's tempting to define an enum, or at least a newtype around the the string and then some of the standard options provided as values exported from this widget.
There was a problem hiding this comment.
I could add a new DOM.Erumu.Widget.Input.Builder module and pattern it after the Button.Builder in Breathmint. Then I could use the Input Builder to replace the CheckboxInput, FileInput, and TextInput helper functions with calls to the builder. That would give me a central place to define the InputType enum and define a default input with the text type and matching message. That would preserve the current API and expose a smart underlying API for building these other input types.
The builder pattern is there, so it really isn't a large lift with so few options.
Adds an option to render a TextInput with a custom type. This will allow us to update the Breathmint TextField widget to render with an
emailtype and display the correct keyboard on mobile devices in the login view.