Add part7

This commit is contained in:
Richard Feldman
2018-05-05 08:04:50 -04:00
parent 8ae366a175
commit c34810f421
576 changed files with 79147 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
module Views.Errors exposing (view)
{-| Render dismissable errors. We use this all over the place!
-}
import Html exposing (..)
import Html.Attributes exposing (class, style)
import Html.Events exposing (onClick)
view : msg -> List String -> Html msg
view dismissErrors errors =
if List.isEmpty errors then
Html.text ""
else
div [ class "error-messages", styles ] <|
List.map (\error -> p [] [ text error ]) errors
++ [ button [ onClick dismissErrors ] [ text "Ok" ] ]
styles : Attribute msg
styles =
style
[ ( "position", "fixed" )
, ( "top", "0" )
, ( "background", "rgb(250, 250, 250)" )
, ( "padding", "20px" )
, ( "border", "1px solid" )
]