2022-03-16 21:46:20 -04:00
|
|
|
import React from "react";
|
|
|
|
import { Cell } from "../types";
|
|
|
|
import styles from "../styles/board.module.css";
|
2022-03-05 09:57:20 -05:00
|
|
|
|
2022-03-16 21:46:20 -04:00
|
|
|
interface BoardProps {
|
|
|
|
cells: Cell[];
|
|
|
|
cellWidth: number;
|
|
|
|
}
|
2022-03-05 09:57:20 -05:00
|
|
|
|
2022-03-16 21:46:20 -04:00
|
|
|
const Board = (props: BoardProps) => {
|
|
|
|
return (
|
|
|
|
<div
|
|
|
|
className={styles.gridContainer}
|
|
|
|
style={{
|
|
|
|
gridTemplateColumns: `repeat(${props.cellWidth}, 1fr)`,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{props.cells.map((cell) => (
|
|
|
|
<div className={styles.gridCell}>{cell.piece}</div>
|
|
|
|
))}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Board;
|