2023-11-03 19:08:20 +01:00
|
|
|
import BingoRow from './bingorow'
|
2023-11-02 23:08:51 +01:00
|
|
|
|
2023-11-02 23:38:12 +01:00
|
|
|
interface Props{
|
|
|
|
size: number;
|
|
|
|
items: string[];
|
|
|
|
}
|
|
|
|
|
|
|
|
export default function Bingo({size, items}: Props){
|
2023-11-03 20:27:44 +01:00
|
|
|
const activeItems: string[] = items.slice(0, size*size);
|
2023-11-02 23:38:12 +01:00
|
|
|
let rows: string[][] = [];
|
2023-11-03 20:27:44 +01:00
|
|
|
for(let i = 0; i < (activeItems.length / size); i++)
|
2023-11-02 23:38:12 +01:00
|
|
|
{
|
2023-11-03 20:27:44 +01:00
|
|
|
rows[i] = activeItems.slice(i * size, (i + 1) * size);
|
2023-11-02 23:38:12 +01:00
|
|
|
}
|
2023-11-02 23:08:51 +01:00
|
|
|
return(
|
2023-11-03 15:21:59 +01:00
|
|
|
<table className='w-1/2 table bg-primary text-primary-content m-auto'>
|
2023-11-02 23:08:51 +01:00
|
|
|
<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>
|
|
|
|
);
|
|
|
|
}
|