diff --git a/src/components/BoardSwitcher.jsx b/src/components/BoardSwitcher.jsx index e99793a..828ec72 100644 --- a/src/components/BoardSwitcher.jsx +++ b/src/components/BoardSwitcher.jsx @@ -1,4 +1,4 @@ -import React from "react"; +import React,{useState} from "react"; function Board(props) { let className = "board"; @@ -10,16 +10,28 @@ function Board(props) { } function BoardSwitcher(props) { - let boards = []; - for (let ii = 0; ii < props.numBoards; ii++) { - let isSelected = ii === 0; - boards.push(); + // const [selected, setSelected] = useState(1); + const [selectedBoardIndex, setSelectedBoardIndex] = useState(0); + + function handleClick (){ + setSelectedBoardIndex( (selectedBoardIndex + 1) % props.numBoards ) + } + let boards = []; + // for (let ii = 0; ii < props.numBoards; ii++) { + // let isSelected = selected === ii + 1 + // boards.push(); + + for (let boardIndex = 0; boardIndex < props.numBoards; boardIndex++) { + let isBoardSelected = selectedBoardIndex === boardIndex; + boards.push() + } return (
{boards}
- + {/* */} +
); } diff --git a/src/main.jsx b/src/main.jsx index 782f402..316ad56 100644 --- a/src/main.jsx +++ b/src/main.jsx @@ -6,6 +6,6 @@ import "./index.css"; const root = ReactDOM.createRoot(document.getElementById("root")); root.render( - + );