Created
January 29, 2018 05:11
-
-
Save basuke/5ede0cf2118cc4766b9f2eff45cdf72c to your computer and use it in GitHub Desktop.
Calc UI
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 (main) | |
import Html exposing (Html, button, div, text) | |
import Html.Events exposing (onClick) | |
main : Program Never Model Msg | |
main = | |
Html.beginnerProgram | |
{ model = 0 | |
, view = view | |
, update = update | |
} | |
type alias Model = | |
Int | |
type Msg | |
= NoMsg | |
update : Msg -> Model -> Model | |
update msg model = | |
case msg of | |
NoMsg -> | |
model | |
view : Model -> Html Msg | |
view model = | |
div [] | |
[ div [] [ div [] [ text "0"] ] | |
, div [] | |
[ button [ onClick NoMsg ] [ text "C" ] | |
, button [ onClick NoMsg ] [ text "+" ] | |
, button [ onClick NoMsg ] [ text "-" ] | |
, button [ onClick NoMsg ] [ text "*" ] | |
, button [ onClick NoMsg ] [ text "/" ] | |
, button [ onClick NoMsg ] [ text "=" ] | |
] | |
, div [] | |
[ button [ onClick NoMsg ] [ text "1" ] | |
, button [ onClick NoMsg ] [ text "2" ] | |
, button [ onClick NoMsg ] [ text "3" ] | |
, button [ onClick NoMsg ] [ text "4" ] | |
, button [ onClick NoMsg ] [ text "5" ] | |
, button [ onClick NoMsg ] [ text "6" ] | |
, button [ onClick NoMsg ] [ text "7" ] | |
, button [ onClick NoMsg ] [ text "8" ] | |
, button [ onClick NoMsg ] [ text "9" ] | |
, button [ onClick NoMsg ] [ text "0" ] | |
] | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment