Expose toString helper.

This commit is contained in:
Dillon Kearns 2022-07-02 09:04:57 -07:00
parent 86890804e4
commit 8a7313516a

View File

@ -1,4 +1,4 @@
module Pages.FormState exposing (Event(..), FieldEvent, FieldState, FieldStatus(..), FormState, PageFormState, init, listeners, setField, setSubmitAttempted, update)
module Pages.FormState exposing (Event(..), FieldEvent, FieldState, FieldStatus(..), FormState, PageFormState, fieldStatusToString, init, listeners, setField, setSubmitAttempted, update)
import Dict exposing (Dict)
import Html exposing (Attribute)
@ -215,6 +215,22 @@ type FieldStatus
| Blurred
fieldStatusToString : FieldStatus -> String
fieldStatusToString fieldStatus =
case fieldStatus of
NotVisited ->
"NotVisited"
Focused ->
"Focused"
Changed ->
"Changed"
Blurred ->
"Blurred"
increaseStatusTo : FieldStatus -> FieldStatus -> FieldStatus
increaseStatusTo increaseTo currentStatus =
if statusRank increaseTo > statusRank currentStatus then