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

59 lines
1.1 KiB
Elm
Raw Normal View History

2020-03-31 22:43:32 +03:00
module Examples.Dropdown exposing (Msg, State, example)
{-|
2020-03-31 22:43:32 +03:00
@docs Msg, State, example
-}
import Category exposing (Category(..))
2020-03-31 23:20:03 +03:00
import Example exposing (Example)
import Html.Styled
import Nri.Ui.Dropdown.V2
{-| -}
type Msg
= ConsoleLog String
{-| -}
2020-03-31 22:43:32 +03:00
type alias State =
List (Nri.Ui.Dropdown.V2.ViewOptionEntry String)
{-| -}
2020-03-31 23:20:03 +03:00
example : Example State Msg
2020-03-31 22:43:32 +03:00
example =
2019-05-10 21:11:44 +03:00
{ name = "Nri.Ui.Dropdown.V2"
2020-03-31 22:43:32 +03:00
, state = init
, update = update
2020-03-31 22:48:26 +03:00
, subscriptions = \_ -> Sub.none
2020-03-31 22:43:32 +03:00
, view =
\state ->
[ Nri.Ui.Dropdown.V2.view "All the foods!" state ConsoleLog
]
, categories = [ Inputs ]
}
{-| -}
2020-03-31 22:43:32 +03:00
init : State
init =
[ { isSelected = False, val = "Burrito", displayText = "Burrito" }
, { isSelected = False, val = "Nacho", displayText = "Nacho" }
, { isSelected = False, val = "Horchata", displayText = "Horchata" }
]
{-| -}
2020-03-31 22:43:32 +03:00
update : Msg -> State -> ( State, Cmd Msg )
update msg state =
case msg of
ConsoleLog message ->
let
_ =
Debug.log "DropdownExample" message
in
( state, Cmd.none )