Skip to content

Instantly share code, notes, and snippets.

@basuke
Created January 29, 2018 05:11
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 basuke/5ede0cf2118cc4766b9f2eff45cdf72c to your computer and use it in GitHub Desktop.
Save basuke/5ede0cf2118cc4766b9f2eff45cdf72c to your computer and use it in GitHub Desktop.
Calc UI
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