Skip to content

Instantly share code, notes, and snippets.

@sethlivingston
Last active June 23, 2016 12:54
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 sethlivingston/a483aae67fa94939d3c1ce74bcb9c40f to your computer and use it in GitHub Desktop.
Save sethlivingston/a483aae67fa94939d3c1ce74bcb9c40f to your computer and use it in GitHub Desktop.
module Components.Tab exposing (Model, Msg, init, view, update)
import Html exposing (Html, div, text, i)
import Html.Attributes exposing (class)
import Html.Events exposing (onClick)
-- MODEL
type alias Model =
{ icon : String
, title : String
}
init: String -> String -> Model
init icon title =
Model icon title
-- MESSAGES
type Msg
= Click
-- VIEW
view : Model -> Html Msg
view model =
div
[ class "tab"
, onClick Click
]
[ i [ class ("fa fa-" ++ model.icon) ] []
, text model.title
]
-- UPDATE
update : Msg -> Model -> ( Model, Cmd Msg )
update message model =
case message of
Click value ->
( model, Cmd.none)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment