This commit is contained in:
Søren Debois 2016-04-06 21:49:02 +02:00
parent f994c82d50
commit 7a918ed60c
5 changed files with 16 additions and 17 deletions

View file

@ -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

View file

@ -115,7 +115,7 @@ addToast =
snackbarComponent : Snackbar.Instance Mdl Action
snackbarComponent =
Snackbar.instance 2 MDL Snackbar.model []
Snackbar.instance 2 MDL Snackbar.model

View file

@ -275,6 +275,7 @@ type alias Instance state obs =
Component.Instance
Model
state
Action
obs
(List Style -> List Html -> Html)

View file

@ -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
-}

View file

@ -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`.