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

66 lines
1.7 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-10-24 20:24:59 +03:00
, category = Layout
, content =
[ Tabs.view
{ title = Nothing
, onSelect = changeTab
, tabs =
case tab of
First ->
2019-09-04 12:03:03 +03:00
List.Zipper.from []
(Tabs.Tab "First tab" First)
[ Tabs.Tab "Second tab" Second ]
Second ->
2019-09-04 12:03:03 +03:00
List.Zipper.from []
(Tabs.Tab "Second tab" Second)
[ Tabs.Tab "First tab" First ]
, 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-09-04 12:03:03 +03:00
List.Zipper.from
2019-05-23 03:19:26 +03:00
[]
(Tabs.NormalLink { label = "Nowhere", href = Nothing })
2019-05-23 17:57:29 +03:00
[ Tabs.NormalLink { label = "Elm", href = Just "http://elm-lang.org" }
2019-10-24 20:24:59 +03:00
, Tabs.SpaLink { label = "Spa", href = "/#category/Layout", msg = changeTab Second }
2019-05-23 17:57:29 +03:00
]
}
]
}