Add part7

This commit is contained in:
Richard Feldman
2018-05-05 04:54:47 -04:00
parent f6bef58e3d
commit 825dea437b
575 changed files with 79140 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" )
]