diff --git a/src/components/BoardSwitcher.jsx b/src/components/BoardSwitcher.jsx index e99793a..7f325e1 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,18 +10,23 @@ function Board(props) { } function BoardSwitcher(props) { + const [selectedBoard, setSelectedBoard] = useState(0); + + const toggleBoard = () => { + setSelectedBoard((prevBoard) => (prevBoard + 1) % props.numBoards); + }; + let boards = []; for (let ii = 0; ii < props.numBoards; ii++) { - let isSelected = ii === 0; + let isSelected = ii === selectedBoard; boards.push(); } return (
{boards}
- +
); } - -export default BoardSwitcher; +export default BoardSwitcher; \ No newline at end of file diff --git a/src/main.jsx b/src/main.jsx index 782f402..8bde308 100644 --- a/src/main.jsx +++ b/src/main.jsx @@ -4,8 +4,12 @@ import BoardSwitcher from "./components/BoardSwitcher"; import "./index.css"; const root = ReactDOM.createRoot(document.getElementById("root")); + +//switch from 3 -> 5 boards +//BoardSwitcher allows for toggle button. if you give it a specific amount it +//will create the boxes root.render( - + );