Update examples
This commit is contained in:
parent
f94de112b5
commit
16c05303d1
3 changed files with 9 additions and 3 deletions
examples
|
@ -32,6 +32,9 @@ type Input =
|
|||
, buttonLabel :: String
|
||||
}
|
||||
|
||||
component :: H.Component HH.HTML S.Query' Input Message Aff
|
||||
component = S.component input spec
|
||||
|
||||
input :: Input -> S.Input State
|
||||
input { items, buttonLabel } =
|
||||
{ inputType: S.Toggle
|
||||
|
|
|
@ -46,6 +46,9 @@ data Message
|
|||
type ChildSlots =
|
||||
( dropdown :: D.Slot Unit )
|
||||
|
||||
component :: H.Component HH.HTML (S.Query Query ChildSlots) Unit Message Aff
|
||||
component = S.component (const input) spec
|
||||
|
||||
-- this typeahead will be opaque; users can just use this pre-built
|
||||
-- input instead of the usual select one.
|
||||
input :: S.Input State
|
||||
|
@ -162,7 +165,7 @@ spec = S.defaultSpec
|
|||
]
|
||||
|
||||
renderDropdown = whenElem (st.visibility == S.On) \_ ->
|
||||
HH.slot _dropdown unit (S.component D.spec) (D.input dropdownInput) handler
|
||||
HH.slot _dropdown unit D.component dropdownInput handler
|
||||
where
|
||||
_dropdown = SProxy :: SProxy "dropdown"
|
||||
handler msg = Just $ S.Action $ HandleDropdown msg
|
||||
|
|
|
@ -88,7 +88,7 @@ dropdown :: forall t0 t1 t2. H.Component HH.HTML t0 t1 t2 Aff
|
|||
dropdown = H.mkComponent
|
||||
{ initialState: const unit
|
||||
, render: \_ ->
|
||||
HH.slot label unit (Select.component Dropdown.spec) (Dropdown.input input) \_ -> Nothing
|
||||
HH.slot label unit Dropdown.component input \_ -> Nothing
|
||||
, eval: H.mkEval H.defaultEval
|
||||
}
|
||||
where
|
||||
|
@ -99,7 +99,7 @@ typeahead :: forall t0 t1 t2. H.Component HH.HTML t0 t1 t2 Aff
|
|||
typeahead = H.mkComponent
|
||||
{ initialState: const unit
|
||||
, render: \_ ->
|
||||
HH.slot label unit (Select.component Typeahead.spec) Typeahead.input \_ -> Nothing
|
||||
HH.slot label unit Typeahead.component unit \_ -> Nothing
|
||||
, eval: H.mkEval H.defaultEval
|
||||
}
|
||||
where
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue