Skip to content

Instantly share code, notes, and snippets.

@stoft
Last active April 17, 2017 07:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stoft/370ebd6808ec83fe1034198ddafc17c5 to your computer and use it in GitHub Desktop.
Save stoft/370ebd6808ec83fe1034198ddafc17c5 to your computer and use it in GitHub Desktop.
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" ]
]
]
@rundis
Copy link

rundis commented Apr 16, 2017

Could probably use Bootstrap.Form.Checkbox ?

@stoft
Copy link
Author

stoft commented Apr 16, 2017

@stoft
Copy link
Author

stoft commented Apr 17, 2017

Added input parameters as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment