Adds errored state

This commit is contained in:
Tessa Kelly 2020-01-16 12:46:20 -08:00
parent b646916573
commit 584d8a8acb
2 changed files with 22 additions and 1 deletions

View File

@ -33,6 +33,7 @@ view :
, id : String
, valueToString : a -> String
, defaultDisplayText : Maybe String
, isInError : Bool
}
-> Html a
view config =
@ -78,7 +79,14 @@ view config =
|> Nri.Ui.styled Html.select
"nri-select-menu"
[ -- border
Css.border3 (Css.px 1) Css.solid Colors.gray75
Css.border3 (Css.px 1)
Css.solid
(if config.isInError then
Colors.purple
else
Colors.gray75
)
, Css.borderBottomWidth (Css.px 4)
, Css.borderRadius (Css.px 8)
, Css.focus [ Css.borderColor Colors.azure ]

View File

@ -42,6 +42,19 @@ example parentMessage state =
, id = "tortilla-selector"
, valueToString = identity
, defaultDisplayText = Just "Select a tasty tortilla based treat!"
, isInError = False
}
|> Html.Styled.map (parentMessage << ConsoleLog)
, Html.Styled.label
[ Html.Styled.Attributes.for "errored-selector" ]
[ Heading.h3 [] [ Html.Styled.text "Errored Selector" ] ]
, Select.view
{ current = Nothing
, choices = []
, id = "errored-selector"
, valueToString = identity
, defaultDisplayText = Just "Please select an option"
, isInError = True
}
|> Html.Styled.map (parentMessage << ConsoleLog)
]