Last active
April 17, 2017 07:47
-
-
Save stoft/370ebd6808ec83fe1034198ddafc17c5 to your computer and use it in GitHub Desktop.
Elm implementation of https://v4-alpha.getbootstrap.com/examples/signin/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Bootstrap.Examples.Signin exposing (..) | |
import Html exposing (Html, node, label, h2, text) | |
import Html.Attributes exposing (rel, href, class, for, required, autofocus, type_) | |
import Html.Events exposing (onCheck, onInput, onSubmit) | |
import Bootstrap.Grid as Grid | |
import Bootstrap.Form as Form | |
import Bootstrap.Form.Checkbox as Checkbox | |
import Bootstrap.Form.Input as Input | |
import Bootstrap.Button as Button | |
import Bootstrap.CDN as CDN | |
main : Html Msg | |
main = | |
view "" "" | |
type Msg | |
= EmailUpdated String | |
| PasswordUpdated String | |
| RememberMeToggled Bool | |
| SigninPressed | |
view : String -> String -> Html Msg | |
view username password = | |
Grid.container [] | |
[ CDN.stylesheet | |
, node "link" [ rel "stylesheet", href "http://v4-alpha.getbootstrap.com/examples/signin/signin.css" ] [] | |
, Form.form [ class "form-signin" ] | |
[ h2 [ class "form-signin-heading" ] [ text "Please sign in" ] | |
, label [ class "sr-only", for "inputEmail" ] [ text "Email address" ] | |
, Input.email | |
[ Input.id "inputEmail" | |
, Input.placeholder "Email address" | |
, Input.attrs [ required True, autofocus True ] | |
, Input.onInput EmailUpdated | |
, Input.value username | |
] | |
, label [ class "sr-only", for "inputPassword" ] [ text "Password" ] | |
, Input.password | |
[ Input.id "inputPassword" | |
, Input.placeholder "Password" | |
, Input.attrs [ required True ] | |
, Input.onInput PasswordUpdated | |
, Input.value password | |
] | |
, Checkbox.checkbox [ Checkbox.onCheck RememberMeToggled ] | |
"Remember me" | |
, Button.button | |
[ Button.large | |
, Button.block | |
, Button.primary | |
, Button.attrs [ type_ "submit", onSubmit SigninPressed ] | |
] | |
[ text "Sign in" ] | |
] | |
] |
Added input parameters as well.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Now live on Ellie as well: https://ellie-app.com/WjHWPVYDtba1/0
With params: https://ellie-app.com/WxCbqWtwqba1/0