buzzword-bingo/src/app/components/bingo.tsx

23 lines
459 B
TypeScript
Raw Normal View History

2023-11-02 23:08:51 +01:00
import styles from './bingo.module.css'
import BingoRow from './bingorow.tsx'
2023-11-02 23:38:12 +01:00
interface Props{
size: number;
items: string[];
}
export default function Bingo({size, items}: Props){
let rows: string[][] = [];
for(let i = 0; i < items.length; i++)
{
rows[i] = items.slice(i * size, (i + 1) * size);
}
2023-11-02 23:08:51 +01:00
return(
<table className={styles.table}>
<tbody>
2023-11-02 23:38:12 +01:00
{rows.map((item, index) => <BingoRow key={index} items={item}/>)}
2023-11-02 23:08:51 +01:00
</tbody>
</table>
);
}