Use only size*size items for bingo

This commit is contained in:
datalore 2023-11-03 20:27:44 +01:00
parent 267582d8a1
commit bc6ec5197e

View File

@ -6,10 +6,11 @@ interface Props{
} }
export default function Bingo({size, items}: Props){ export default function Bingo({size, items}: Props){
const activeItems: string[] = items.slice(0, size*size);
let rows: string[][] = []; let rows: string[][] = [];
for(let i = 0; i < (items.length / size); i++) for(let i = 0; i < (activeItems.length / size); i++)
{ {
rows[i] = items.slice(i * size, (i + 1) * size); rows[i] = activeItems.slice(i * size, (i + 1) * size);
} }
return( return(
<table className='w-1/2 table bg-primary text-primary-content m-auto'> <table className='w-1/2 table bg-primary text-primary-content m-auto'>