module Go.View exposing (..) import Go.Util exposing (allIndices, pair, lookup) import Go.Types exposing (..) import Html exposing (Html, div, text, p) import Html.Attributes exposing (class, classList) import Html.Events exposing (onClick) renderIndex : (Index, Maybe Color) -> Html Msg renderIndex (index, color) = let extraClass = case color of Just c -> (if c == Black then "black-cell" else "white-cell", True) Nothing -> ("", False) in div [ classList [ ("board-cell", True), extraClass ] , onClick (Place index) ] [ ] renderBoard : Int -> Board -> Html Msg renderBoard size board = let cells = List.map (\i -> (lookup i board) |> (pair i)) <| allIndices size in div [] <| List.map renderIndex cells