Move stuff

This commit is contained in:
Richard Feldman
2018-08-05 04:13:33 -04:00
parent bf20622319
commit 7793c69762
3419 changed files with 6 additions and 7 deletions

View File

@@ -0,0 +1,40 @@
module Views.Form exposing (input, password, textarea, viewErrors)
import Html exposing (Attribute, Html, fieldset, li, text, ul)
import Html.Attributes exposing (class, type_)
password : List (Attribute msg) -> List (Html msg) -> Html msg
password attrs =
control Html.input ([ type_ "password" ] ++ attrs)
input : List (Attribute msg) -> List (Html msg) -> Html msg
input attrs =
control Html.input ([ type_ "text" ] ++ attrs)
textarea : List (Attribute msg) -> List (Html msg) -> Html msg
textarea =
control Html.textarea
viewErrors : List ( a, String ) -> Html msg
viewErrors errors =
errors
|> List.map (\( _, error ) -> li [] [ text error ])
|> ul [ class "error-messages" ]
-- INTERNAL --
control :
(List (Attribute msg) -> List (Html msg) -> Html msg)
-> List (Attribute msg)
-> List (Html msg)
-> Html msg
control element attributes children =
fieldset [ class "form-group" ]
[ element (class "form-control" :: attributes) children ]