diff --git a/src/app/components/bingo.tsx b/src/app/components/bingo.tsx index 24b1f93..5ca86e4 100644 --- a/src/app/components/bingo.tsx +++ b/src/app/components/bingo.tsx @@ -1,15 +1,21 @@ import styles from './bingo.module.css' import BingoRow from './bingorow.tsx' -export default function Bingo(){ +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); + } return( - - - - - + {rows.map((item, index) => )}
); diff --git a/src/app/components/bingoitem.tsx b/src/app/components/bingoitem.tsx index 0352cff..6c9c196 100644 --- a/src/app/components/bingoitem.tsx +++ b/src/app/components/bingoitem.tsx @@ -1,7 +1,11 @@ import styles from './bingo.module.css' -export default function BingoItem(){ +interface Props{ + text: string; +} + +export default function BingoItem({text}: Props){ return( - Item + {text} ); } diff --git a/src/app/components/bingorow.tsx b/src/app/components/bingorow.tsx index 7573179..2c95e6a 100644 --- a/src/app/components/bingorow.tsx +++ b/src/app/components/bingorow.tsx @@ -1,13 +1,13 @@ import BingoItem from './bingoitem.tsx' -export default function BingoRow(){ +interface Props{ + items: string[]; +} + +export default function BingoRow({items}: Props){ return( - - - - - + {items.map((item, index) => )} ); } diff --git a/src/app/page.tsx b/src/app/page.tsx index 338a3f9..d3c5c10 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -2,10 +2,11 @@ import styles from './page.module.css' import Bingo from './components/bingo.tsx' export default function Home(){ + const items=["test1", "test2", "test3", "test4", "test5"]; return(

Buzzword Bingo

- +
); }