Created
August 31, 2017 07:09
-
-
Save anonymous/55e5a3b2096b89142f0beffd7536940c to your computer and use it in GitHub Desktop.
Untitled
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
{ | |
"version": "1.0.0", | |
"summary": "Tell the world about your project!", | |
"repository": "https://github.com/user/project.git", | |
"license": "BSD3", | |
"source-directories": [ | |
"." | |
], | |
"exposed-modules": [], | |
"dependencies": { | |
"elm-lang/core": "5.1.1 <= v < 5.1.1", | |
"elm-lang/html": "2.0.0 <= v < 2.0.0" | |
}, | |
"elm-version": "0.18.0 <= v < 0.19.0" | |
} |
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
<html> | |
<head> | |
<style> | |
html { | |
background: #F7F7F7; | |
color: red; | |
} | |
</style> | |
</head> | |
<body> | |
<script> | |
var app = Elm.Main.fullscreen() | |
</script> | |
</body> | |
</html> |
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 Main exposing (..) | |
import Html exposing (Html, text, input, div) | |
import Html.Attributes as Attr exposing (type_, step) | |
import Html.Events exposing (onInput) | |
dateInput : List (Html.Attribute msg) -> List (Html msg) -> Html msg | |
dateInput attr children = | |
input (attr ++ [ type_ "date", step "1", Attr.min "2017-01-01" ]) children | |
timeInput : List (Html.Attribute msg) -> List (Html msg) -> Html msg | |
timeInput attr children = | |
input (attr ++ [ type_ "time", step "5", Attr.min "00:00" ]) children | |
type Msg | |
= DateUpdated String | |
| TimeUpdated String | |
type alias Model = | |
{ date : String | |
, time : String | |
} | |
model : Model | |
model = | |
{ date = "" | |
, time = "" | |
} | |
main = | |
Html.beginnerProgram | |
{ model = model | |
, view = view | |
, update = update | |
} | |
update msg model = | |
case msg of | |
DateUpdated to -> | |
{ model | date = to } | |
TimeUpdated to -> | |
{ model | time = to } | |
view model = | |
div [] | |
[ dateInput [ onInput DateUpdated ] [] | |
, div [] [ text model.date ] | |
, timeInput [ onInput TimeUpdated ] [] | |
, div [] [ text model.time ] | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment