Skip to content

Instantly share code, notes, and snippets.

@seanhess
Last active September 9, 2016 06:37
Show Gist options
  • Save seanhess/021bf43db85dd6731476e40cef92860c to your computer and use it in GitHub Desktop.
Save seanhess/021bf43db85dd6731476e40cef92860c to your computer and use it in GitHub Desktop.
module Reuse.TabsExercise exposing (..)
import Html exposing (Html, div, text, button, span, header, a)
import Html.Attributes exposing (style)
import Html.Events exposing (onClick)
import Html.App as Html
import Reuse.Functions as Order exposing (Msg3(..), update3, Model)
import Reuse.Examples.Button as Button
main =
Html.beginnerProgram
{ model = model
, view = test
, update = update
}
model = Home
update : Msg' -> Page -> Page
update msg page =
case msg of
Navigate p ->
p
type Page
= Home
| About
| Users
type Msg'
= Navigate Page
test : Page -> Html Msg'
test page =
let tab isActive = []
content = []
in div []
[ header [ ]
[ a [ style (tab (page == Home)), onClick (Navigate Home) ]
[ text "Home"]
, a [ style (tab (page == About)) , onClick (Navigate About)]
[ text "About"]
, a [ style (tab (page == Users)) , onClick (Navigate Users)]
[ text "Users"]
]
, div [ ]
[ div [ style content ]
[ case page of
Home ->
div [] [ text "Home Page" ]
About ->
div [] [ text "Very important about information"]
Users ->
div [] [ text "Users!"]
]
]
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment