Skip to content

Commit

Permalink
try again
Browse files Browse the repository at this point in the history
  • Loading branch information
StevieBrooks committed Nov 6, 2023
1 parent 9a0d3f0 commit b31afdc
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 10 deletions.
4 changes: 1 addition & 3 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ export default function App() {

const [player, setPlayer] = useState(1)
const [boardState, setBoardState] = useState([
[null, null, null],
[null, null, null],
[null, null, null],
null, null, null, null, null, null, null, null, null
])
const [result, setResult] = useState("")

Expand Down
5 changes: 5 additions & 0 deletions src/components/Button.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default function Button( { btnTitle, btnFunction } ) {
return (<>
<button onClick={btnFunction}>{btnTitle}</button>
</>)
}
16 changes: 16 additions & 0 deletions src/components/DashBoard.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import Button from "./Button"

export default function DashBoard() {

const resetFunc = () => {

}

return (

<div className="dashboard w-96 m-auto bg-slate-300 flex justify-center">
<Button btnTitle="Reset" btnFunction={resetFunc} />
</div>

)
}
21 changes: 15 additions & 6 deletions src/components/GameBoard.jsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
import GameCell from "./GameCell"
import { useContext, useState } from "react"
import { GameState } from "../ContextFile"
import GameCell from "./GameCell"
import ScoreBoard from "./ScoreBoard"
import DashBoard from "./DashBoard"

export default function GameBoard() {

const [player, setPlayer, boardState, setBoardState, result, setResult] = useContext(GameState)

return (

<div className="game-board w-96 h-96 bg-slate-600 m-auto relative top-12 flex flex-wrap justify-center items-center">
{boardState.map((cell, index) => (
cell.map((gameCell, index) => (
<div className="game-container">
<ScoreBoard />

<div className="game-board w-96 h-96 bg-slate-600 m-auto flex flex-wrap justify-center items-center">
{boardState.map((cell, index) => (
<GameCell key={index} />
))
))}
))}
</div>

<DashBoard />

</div>



)
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/GameCell.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default function GameCell() {
return (
<div className="game-cell w-28 h-28 mx-2 bg-slate-400"></div>
<div className="game-cell w-28 h-28 m-2 bg-slate-400"></div>
)
}
11 changes: 11 additions & 0 deletions src/components/ScoreBoard.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export default function ScoreBoard() {
return (

<div className="scoreboard w-96 bg-slate-300 m-auto flex flex-wrap justify-around items-center">
<h3>P1: <span>00</span></h3>
<h3>P2: <span>00</span></h3>
</div>
)
}

// should build form so players can name themselves

2 comments on commit b31afdc

@vercel
Copy link

@vercel vercel bot commented on b31afdc Nov 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on b31afdc Nov 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.