mirror of
https://github.com/correl/elm-mdl.git
synced 2024-12-25 11:11:13 +00:00
Misc
This commit is contained in:
parent
f994c82d50
commit
7a918ed60c
5 changed files with 16 additions and 17 deletions
|
@ -10,7 +10,6 @@ import Material.Grid as Grid
|
|||
import Material.Icon as Icon
|
||||
import Material.Style exposing (Style)
|
||||
|
||||
import Material.Textfield as Textfield
|
||||
|
||||
|
||||
-- MODEL
|
||||
|
|
|
@ -115,7 +115,7 @@ addToast =
|
|||
|
||||
snackbarComponent : Snackbar.Instance Mdl Action
|
||||
snackbarComponent =
|
||||
Snackbar.instance 2 MDL Snackbar.model []
|
||||
Snackbar.instance 2 MDL Snackbar.model
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -275,6 +275,7 @@ type alias Instance state obs =
|
|||
Component.Instance
|
||||
Model
|
||||
state
|
||||
Action
|
||||
obs
|
||||
(List Style -> List Html -> Html)
|
||||
|
||||
|
|
|
@ -296,18 +296,28 @@ type alias Observer obs =
|
|||
Component.Observer (Action obs) obs
|
||||
|
||||
|
||||
actionObserver : Observer ons
|
||||
actionObserver action =
|
||||
case action of
|
||||
Action action' ->
|
||||
Just action'
|
||||
|
||||
_ ->
|
||||
Nothing
|
||||
|
||||
|
||||
|
||||
{-| Component instance.
|
||||
-}
|
||||
instance :
|
||||
Int
|
||||
-> (Component.Action (State state obs) obs -> obs)
|
||||
-> (Model obs)
|
||||
-> List (Observer obs)
|
||||
-> Instance (State state obs) obs
|
||||
|
||||
instance id lift model0 observers =
|
||||
instance id lift model0 =
|
||||
Component.instance
|
||||
view update .snackbar (\x y -> {y | snackbar = x}) id lift model0 observers
|
||||
view update .snackbar (\x y -> {y | snackbar = x}) id lift model0 [ actionObserver ]
|
||||
|
||||
|
||||
{-|
|
||||
|
@ -325,14 +335,3 @@ add contents inst model =
|
|||
in
|
||||
(inst.set sb model, Effects.map inst.fwd fx)
|
||||
|
||||
{-| Lift the button Click action to your own action. E.g.,
|
||||
-}
|
||||
{-
|
||||
fwdClick : obs -> (Observer obs)
|
||||
fwdClick obs action =
|
||||
case action of
|
||||
Click -> Just obs
|
||||
_ -> Nothing
|
||||
|
||||
-}
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ type alias State state =
|
|||
{-|
|
||||
-}
|
||||
type alias Instance state obs =
|
||||
Component.Instance Model state obs Html
|
||||
Component.Instance Model state Action obs Html
|
||||
|
||||
|
||||
{-| Component constructor. See module `Material`.
|
||||
|
|
Loading…
Reference in a new issue