mirror of
https://github.com/NoRedInk/noredink-ui.git
synced 2024-12-01 00:34:27 +03:00
26608637e5
* add table v4 with builtin keyframes * get things looking good in the styleguide * remove log
76 lines
1.2 KiB
Elm
76 lines
1.2 KiB
Elm
module Examples.Select exposing
|
|
( Msg
|
|
, State
|
|
, Value
|
|
, example
|
|
, init
|
|
, update
|
|
)
|
|
|
|
{-|
|
|
|
|
@docs Msg
|
|
@docs State
|
|
@docs Value
|
|
@docs example
|
|
@docs init
|
|
@docs update
|
|
|
|
-}
|
|
|
|
import Html.Styled
|
|
import ModuleExample exposing (Category(..), ModuleExample)
|
|
import Nri.Ui.Select.V5 as Select
|
|
|
|
|
|
{-| -}
|
|
type alias Value =
|
|
String
|
|
|
|
|
|
{-| -}
|
|
type Msg
|
|
= ConsoleLog String
|
|
|
|
|
|
{-| -}
|
|
type alias State value =
|
|
Select.Config value
|
|
|
|
|
|
{-| -}
|
|
example : (Msg -> msg) -> State Value -> ModuleExample msg
|
|
example parentMessage state =
|
|
{ filename = "Nri.Ui.Select.V3"
|
|
, category = Inputs
|
|
, content =
|
|
[ Html.Styled.map (parentMessage << ConsoleLog) (Select.view state)
|
|
]
|
|
}
|
|
|
|
|
|
{-| -}
|
|
init : State Value
|
|
init =
|
|
{ current = ""
|
|
, choices =
|
|
[ { label = "Tacos", value = "Tacos" }
|
|
, { label = "Burritos", value = "Burritos" }
|
|
, { label = "Enchiladas", value = "Enchiladas" }
|
|
]
|
|
, id = Nothing
|
|
, valueToString = identity
|
|
}
|
|
|
|
|
|
{-| -}
|
|
update : Msg -> State Value -> ( State Value, Cmd Msg )
|
|
update msg state =
|
|
case msg of
|
|
ConsoleLog message ->
|
|
let
|
|
_ =
|
|
Debug.log "SelectExample" message
|
|
in
|
|
( state, Cmd.none )
|