Make the column viewing code lazy
This commit is contained in:
parent
673c802f91
commit
e78655c2c7
16
src/Main.elm
16
src/Main.elm
|
@ -14,6 +14,7 @@ import Html.Attributes exposing (class, id, style, value)
|
|||
import Html.Attributes.Extra as Attributes exposing (attributeIf)
|
||||
import Html.Extra exposing (viewMaybe)
|
||||
import Html.Events exposing (onBlur, onClick, onInput, onMouseEnter)
|
||||
import Html.Lazy exposing (lazy2)
|
||||
import Json.Decode as D
|
||||
import List exposing (map, singleton)
|
||||
import Maybe.Extra exposing (isJust)
|
||||
|
@ -105,16 +106,19 @@ subscriptions model = Sub.batch
|
|||
|
||||
view : Model -> Browser.Document Msg
|
||||
view {columns, heldTile, mousePos} =
|
||||
[ section
|
||||
[ class "columns"
|
||||
]
|
||||
( Array.indexedMap (viewColumn heldTile) columns
|
||||
|> Array.toList
|
||||
)
|
||||
[ lazy2 viewColumns heldTile columns
|
||||
, viewMaybe (viewFloatyTile mousePos) heldTile
|
||||
]
|
||||
|> Browser.Document "meow!"
|
||||
|
||||
viewColumns : Maybe HeldTile -> Array Column -> Html Msg
|
||||
viewColumns heldTile columns =
|
||||
let _ = Debug.log "meow" "mew" in
|
||||
Array.indexedMap (viewColumn heldTile) columns
|
||||
|> Array.toList
|
||||
|> section [class "columns"]
|
||||
|
||||
|
||||
viewFloatyTile : (Int, Int) -> HeldTile -> Html Msg
|
||||
viewFloatyTile (mouseX, mouseY) { tile, hoveredColumnIndex } =
|
||||
div
|
||||
|
|
Loading…
Reference in a new issue