2018-11-12 23:25:37 +03:00
|
|
|
module Examples.Tabs exposing
|
|
|
|
( example
|
|
|
|
, Tab(..)
|
|
|
|
)
|
2018-11-10 01:01:11 +03:00
|
|
|
|
|
|
|
{-|
|
|
|
|
|
|
|
|
@docs example
|
|
|
|
|
|
|
|
-}
|
|
|
|
|
|
|
|
import Html.Styled as Html
|
|
|
|
import List.Zipper
|
|
|
|
import ModuleExample as ModuleExample exposing (Category(..), ModuleExample)
|
2018-11-12 23:25:37 +03:00
|
|
|
import Nri.Ui.Tabs.V3 as Tabs
|
2018-11-10 01:01:11 +03:00
|
|
|
|
|
|
|
|
|
|
|
type Tab
|
|
|
|
= First
|
|
|
|
| Second
|
|
|
|
|
|
|
|
|
2018-11-12 23:25:37 +03:00
|
|
|
example : (Tab -> msg) -> Tab -> ModuleExample msg
|
|
|
|
example changeTab tab =
|
2019-02-23 08:00:04 +03:00
|
|
|
{ filename = "Nri.Ui.Tabs.V3"
|
2018-11-10 01:01:11 +03:00
|
|
|
, category = Behaviors
|
|
|
|
, content =
|
|
|
|
[ Tabs.view
|
|
|
|
{ title = Nothing
|
2018-11-12 23:25:37 +03:00
|
|
|
, onSelect = changeTab
|
|
|
|
, tabs =
|
|
|
|
case tab of
|
|
|
|
First ->
|
|
|
|
List.Zipper.Zipper [] (Tabs.Tab "First tab" First) [ Tabs.Tab "Second tab" Second ]
|
|
|
|
|
|
|
|
Second ->
|
|
|
|
List.Zipper.Zipper [ Tabs.Tab "First tab" First ] (Tabs.Tab "Second tab" Second) []
|
2018-11-10 01:01:11 +03:00
|
|
|
, content =
|
|
|
|
\id ->
|
|
|
|
case id of
|
|
|
|
First ->
|
|
|
|
Html.text "First"
|
|
|
|
|
|
|
|
Second ->
|
|
|
|
Html.text "Second"
|
|
|
|
, alignment = Tabs.Center
|
|
|
|
}
|
2018-11-12 23:25:37 +03:00
|
|
|
, Tabs.links
|
|
|
|
{ title = Nothing
|
|
|
|
, content = Html.text "Links"
|
|
|
|
, alignment = Tabs.Left
|
|
|
|
, tabs =
|
|
|
|
List.Zipper.Zipper [] (Tabs.TabLink "Nowhere" Nothing) [ Tabs.TabLink "Elm" (Just "http://elm-lang.org") ]
|
|
|
|
}
|
2018-11-10 01:01:11 +03:00
|
|
|
]
|
|
|
|
}
|