Compose two components (fake actions, since grid doesn't do anything yet)
This commit is contained in:
parent
fcea3f87fe
commit
82d85b834b
|
@ -6,6 +6,7 @@ module Component.CatalogGrid
|
|||
, Action
|
||||
, Interface (..)
|
||||
, view
|
||||
, update
|
||||
) where
|
||||
|
||||
import Miso
|
||||
|
@ -23,6 +24,8 @@ import Miso
|
|||
, p_
|
||||
, br_
|
||||
, id_
|
||||
, Effect
|
||||
, noEff
|
||||
)
|
||||
|
||||
type Model = ()
|
||||
|
@ -37,13 +40,20 @@ data Interface a = Interface
|
|||
, selectThread :: ()
|
||||
}
|
||||
|
||||
update
|
||||
:: Interface a
|
||||
-> Action
|
||||
-> Model
|
||||
-> Effect a Model
|
||||
update = const $ const noEff
|
||||
|
||||
view :: Interface a -> Model -> View a
|
||||
view iface model =
|
||||
div_
|
||||
[ class_ "threads" ]
|
||||
[ div_
|
||||
[ id_ "Grid" ]
|
||||
[ gridItem | _ <- [0..10] ]
|
||||
[ gridItem | _ <- [0..10] :: [ Int ] ]
|
||||
]
|
||||
|
||||
gridItem :: View a
|
||||
|
|
|
@ -73,8 +73,15 @@ mainView model =
|
|||
, Grid.view iGrid (gridModel model)
|
||||
]
|
||||
|
||||
|
||||
mainUpdate :: Action -> Model -> Effect Action Model
|
||||
mainUpdate = const noEff
|
||||
mainUpdate NoAction m = noEff m
|
||||
mainUpdate GetLatest m = noEff m
|
||||
mainUpdate GetThread {..} m = noEff m
|
||||
mainUpdate (GridAction ga) m =
|
||||
Grid.update iGrid ga (gridModel m)
|
||||
>>= \gm -> noEff (m { gridModel = gm })
|
||||
|
||||
|
||||
iGrid :: Grid.Interface Action
|
||||
iGrid = Grid.Interface
|
||||
|
|
Loading…
Reference in New Issue