freego_api/ui/components/board.tsx
fry 209a4f5caf Board that corresponds to what the api gives us (#4)
Display what the API gives us as the board + pieces.

Co-authored-by: David Frymoyer <david.frymoyer@gmail.com>
Reviewed-on: #4
Co-authored-by: fry <david.frymoyer@gmail.com>
Co-committed-by: fry <david.frymoyer@gmail.com>
2022-03-16 21:46:20 -04:00

26 lines
513 B
TypeScript

import React from "react";
import { Cell } from "../types";
import styles from "../styles/board.module.css";
interface BoardProps {
cells: Cell[];
cellWidth: number;
}
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;