Separate the width and height of the grid

This commit is contained in:
2023-02-10 20:39:13 +01:00
parent 2920e6614f
commit 7fd8d54b34
3 changed files with 30 additions and 12 deletions

View File

@@ -1,10 +1,11 @@
use crate::hand_view::HandView;
use crate::tile_view::PlacedTileView;
use board_shared::board::{self, Board};
use board_shared::board::Board;
use board_shared::expr::is_valid_guess;
use board_shared::game::Game;
use board_shared::tile::Tile;
use gloo_dialogs::alert;
use board_shared::position::Grid2d;
use yew::prelude::*;
enum SelectedTile {
@@ -23,9 +24,9 @@ struct BoardViewProps {
fn board_view(BoardViewProps { board, on_click }: &BoardViewProps) -> Html {
html! {
<table class="board">
{ (0..board::BOARD_SIZE).map(|x| html! {
{ (0..board.height()).map(|y| html! {
<tr class="board-row">
{ (0..board::BOARD_SIZE).map(|y| html! {
{ (0..board.width()).map(|x| html! {
<PlacedTileView x={x} y={y} key={x} tile={board.get(x, y)} on_click={on_click.clone()} />
}).collect::<Html>() }
</tr>