1
0
Fork 0
tooty/src/View/Error.elm

35 lines
754 B
Elm
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

module View.Error
exposing
( errorView
, errorsListView
)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Types exposing (..)
errorView : Int -> ErrorNotification -> Html Msg
errorView index error =
div [ class "alert alert-danger" ]
[ button
[ type_ "button"
, class "close"
, onClick <| ClearError index
]
[ text "×" ]
, text error.message
]
errorsListView : Model -> Html Msg
errorsListView model =
case model.errors of
[] ->
text ""
errors ->
div [ class "error-list" ] <|
List.indexedMap errorView model.errors