From 483f50327d6ffe2329574b4b843f70de3570c350 Mon Sep 17 00:00:00 2001 From: selim Date: Sat, 28 Dec 2024 16:52:36 +0100 Subject: [PATCH] Added hover properties and fancy ui with bonus div --- src/App.jsx | 21 +++++++++++++++------ src/index.css | 40 +++++++++++++++++++++++++++++++--------- 2 files changed, 46 insertions(+), 15 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index 25f7bd9..3cd04dd 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -40,21 +40,25 @@ export default function App() { - ); } -function Field({ row, col, backgroundColor, disabled }) { +function Field({ row, col, style, disabled }) { + const [pointer, setPointer] = useState(false); + const styling = { backgroundColor: style.backgroundColor, cursor: pointer && "pointer" }; + return ( @@ -62,6 +66,7 @@ function Field({ row, col, backgroundColor, disabled }) { } function Board() { + let fields = params.colorBoard.map((subarr, row) => subarr.map((color, col) => { return ( @@ -69,8 +74,9 @@ function Board() { key={row.toString() + col.toString()} row={row} col={col} - backgroundColor={{ backgroundColor: color }} + style={{ backgroundColor: color }} disabled={row === 0 ? params.gameOver : true} + /> ); }) @@ -79,8 +85,11 @@ function Board() { const displayMem = params.menu ? "none" : ""; return ( -
- {fields.map((subarr) => subarr.map((field) => field))} +
+
+ {fields.map((subarr) => subarr.map((field) => field))} +
+
); } diff --git a/src/index.css b/src/index.css index 2036c26..f301147 100644 --- a/src/index.css +++ b/src/index.css @@ -4,19 +4,27 @@ body { color: black; } -.board { +.board-outer { width: 700px; - height: 600px; - display: grid; - grid-template-columns: repeat(7, auto [col-start]); - margin-top: 50px; - margin-left: auto; - margin-right: auto; border: 5px solid black; background-color: blue; + margin-top: 30px; + margin-left: auto; + margin-right: auto; } -.board .field { +.board-inner { + width: 630px; + height: 540px; + display: grid; + grid-template-columns: repeat(7, auto [col-start]); + margin-left: auto; + margin-right: auto; + margin-top: 20px; + margin-bottom: 20px; +} + +.board-inner .field { border: 3px solid black; border-radius: 100%; margin: 10px; @@ -28,10 +36,15 @@ body { font-size: xx-large; border: 3px solid black; background-color: white; - margin-top: 20px; + margin-bottom: 30px; } +.restart:hover { + cursor: pointer; + background-color: lightgray; +} + .gamemode-div { margin-left: auto; @@ -51,4 +64,13 @@ body { height: 50px; font-size: larger; +} + +.gamemode-div .gamemode-button:hover { + cursor: pointer; + background-color: lightgray; +} + +.message { + font-size: larger; } \ No newline at end of file