noredink-ui/styleguide-app/Examples/Tabs.elm

62 lines
1.6 KiB
Elm
Raw Normal View History

module Examples.Tabs exposing
( example
, Tab(..)
)
{-|
@docs example
-}
import Html.Styled as Html
import List.Zipper
import ModuleExample as ModuleExample exposing (Category(..), ModuleExample)
2019-05-23 01:25:30 +03:00
import Nri.Ui.Tabs.V4 as Tabs
type Tab
= First
| Second
example : (Tab -> msg) -> Tab -> ModuleExample msg
example changeTab tab =
2019-05-23 01:25:30 +03:00
{ name = "Nri.Ui.Tabs.V4"
2019-05-03 19:30:02 +03:00
, category = Widgets
, content =
[ Tabs.view
{ title = Nothing
, 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) []
, content =
\id ->
case id of
First ->
Html.text "First"
Second ->
Html.text "Second"
, alignment = Tabs.Center
}
, Tabs.links
{ title = Nothing
, content = Html.text "Links"
, alignment = Tabs.Left
, tabs =
2019-05-23 03:19:26 +03:00
List.Zipper.Zipper
[]
(Tabs.NormalLink { label = "Nowhere", href = Nothing })
2019-05-23 17:57:29 +03:00
[ Tabs.NormalLink { label = "Elm", href = Just "http://elm-lang.org" }
, Tabs.SpaLink { label = "Spa", href = "/#category/Widgets", msg = changeTab Second }
]
}
]
}