From cd187bf595f107b7a6277eaf043211db85ff40f1 Mon Sep 17 00:00:00 2001 From: Mikayla Dobson Date: Sat, 27 Aug 2022 15:57:09 -0500 Subject: [PATCH] in progress: major changes to gameboard styling --- src/components/Card/CardRow.scss | 4 +-- src/components/Gameboard/Gameboard.scss | 26 +++++++++++++++++--- src/components/Gameboard/Gameboard.tsx | 22 ++++++++++------- src/components/Nobles/Nobles.scss | 15 +++++++---- src/components/Nobles/Nobles.tsx | 10 ++++++-- src/components/Player/AllPlayers.scss | 4 ++- src/components/Player/Player.tsx | 6 +---- src/components/Resources/AvailableChips.scss | 6 +++-- src/components/Resources/SelectionView.tsx | 6 ++--- src/sass/App.scss | 5 ++-- 10 files changed, 68 insertions(+), 36 deletions(-) diff --git a/src/components/Card/CardRow.scss b/src/components/Card/CardRow.scss index bfac8e9..a09c4c2 100644 --- a/src/components/Card/CardRow.scss +++ b/src/components/Card/CardRow.scss @@ -4,8 +4,8 @@ .card-row { display: flex; flex-flow: column nowrap; - margin: 1rem; - width: 80vw; + margin: 1rem 0; + width: 55vw; .card-row-top-bar { display: flex; diff --git a/src/components/Gameboard/Gameboard.scss b/src/components/Gameboard/Gameboard.scss index fec468d..973215d 100644 --- a/src/components/Gameboard/Gameboard.scss +++ b/src/components/Gameboard/Gameboard.scss @@ -1,11 +1,29 @@ -.gameboard-rows { +.gameboard { display: flex; - flex-flow: column nowrap; + flex-flow: row nowrap; align-items: center; + justify-content: center; background-color: rgb(57, 57, 65); - width: 90vw; - padding: 1rem 1rem 4rem; + width: 100%; + + section { + display: flex; + flex-flow: column nowrap; + align-items: center; + justify-content: flex-start; + margin: 1rem; + } + + .gameboard-left { + min-width: 50vw; + padding: 1rem; + } + + .gameboard-right { + min-width: 35vw; + padding: 1rem; + } .round-marker { font-size: 1.5rem; diff --git a/src/components/Gameboard/Gameboard.tsx b/src/components/Gameboard/Gameboard.tsx index 297516b..2cdb8c9 100644 --- a/src/components/Gameboard/Gameboard.tsx +++ b/src/components/Gameboard/Gameboard.tsx @@ -86,15 +86,19 @@ export default function Gameboard({ state, setState }: StateProps) { ); } else { setView( -
-

Round: {state.round}

- - - - - - - +
+
+

Round: {state.round}

+ + + + +
+
+ + + +
) } diff --git a/src/components/Nobles/Nobles.scss b/src/components/Nobles/Nobles.scss index f22dbfd..c3f565c 100644 --- a/src/components/Nobles/Nobles.scss +++ b/src/components/Nobles/Nobles.scss @@ -5,12 +5,17 @@ flex-flow: column nowrap; background-color: rgb(212, 196, 152); color: black; - padding: 1.5rem 0; - width: 65vw; + padding: 1rem 0; + min-width: 55vw; - .noble-header { - position: relative; - bottom: 1rem; + .nobles-topbar { + display: flex; + flex-flow: row nowrap; + justify-content: center; + align-items: baseline; + > * { + margin: 0 1rem; + } } .all-nobles { diff --git a/src/components/Nobles/Nobles.tsx b/src/components/Nobles/Nobles.tsx index 49b0859..ebc2d23 100644 --- a/src/components/Nobles/Nobles.tsx +++ b/src/components/Nobles/Nobles.tsx @@ -2,8 +2,11 @@ import { v4 } from "uuid"; import { NobleData, ResourceCost } from "../../util/types"; import { StateProps } from "../../util/propTypes"; import "../Nobles/Nobles.scss" +import { useState } from "react"; export default function Nobles({ state }: StateProps) { + const [collapsed, setCollapsed] = useState(true); + if (!state.gameboard.nobles.length) { return (
@@ -15,8 +18,11 @@ export default function Nobles({ state }: StateProps) { return (
- NOBLES: 3 points each -
+
+ NOBLES + +
+
{ state && state.gameboard.nobles.map((noble: NobleData) => { return ( diff --git a/src/components/Player/AllPlayers.scss b/src/components/Player/AllPlayers.scss index f823dae..12d7e8c 100644 --- a/src/components/Player/AllPlayers.scss +++ b/src/components/Player/AllPlayers.scss @@ -5,11 +5,13 @@ .all-players { display: flex; justify-content: space-around; - min-width: 80vw; + max-width: 80vw; + padding: 0 2rem; background-color: rgb(237, 213, 156); color: black; .player-ui { + width: 30vw; p { margin: 1rem; } diff --git a/src/components/Player/Player.tsx b/src/components/Player/Player.tsx index f3ce8f4..0472df6 100644 --- a/src/components/Player/Player.tsx +++ b/src/components/Player/Player.tsx @@ -52,13 +52,12 @@ export default function Player({ player, state, setState }: PlayerProps) { } return ( -
+

Name: {player.name} {player.starter && "(round starter)"}

{/* Dynamic data from state */}

Score: {dynamic && dynamic.points}

-

{dynamic?.turnActive ? "It's your turn!" : "..."}

{/* Player actions */} -
-

{dynamic?.name}'s Resources

-

Chips:

diff --git a/src/components/Resources/AvailableChips.scss b/src/components/Resources/AvailableChips.scss index 4c47bd8..756678d 100644 --- a/src/components/Resources/AvailableChips.scss +++ b/src/components/Resources/AvailableChips.scss @@ -2,8 +2,10 @@ .available-chips { display: flex; - flex-flow: row nowrap; - background-color: rgb(236, 238, 186); + flex-flow: row wrap; + max-width: 50%; + align-items: center; + justify-content: center; color: black; p { diff --git a/src/components/Resources/SelectionView.tsx b/src/components/Resources/SelectionView.tsx index 2e08708..e635d76 100644 --- a/src/components/Resources/SelectionView.tsx +++ b/src/components/Resources/SelectionView.tsx @@ -15,6 +15,8 @@ export default function SelectionView({ state, setState }: StateProps) { const [view, setView] = useState(<>); useEffect(() => { + setCurrentPlayer(useCurrentPlayer(state)); + setView(() => { switch (true) { case (actionTypes[0].active): @@ -36,9 +38,7 @@ export default function SelectionView({ state, setState }: StateProps) { ); } }) - - setCurrentPlayer(useCurrentPlayer(state)); - }, [state, state.actions, setState]) + }, [state, setState]) return view } \ No newline at end of file diff --git a/src/sass/App.scss b/src/sass/App.scss index ac7a180..18c1519 100644 --- a/src/sass/App.scss +++ b/src/sass/App.scss @@ -8,8 +8,7 @@ display: flex; align-items: center; justify-content: center; - max-width: 1280px; - margin: 0 auto; - padding: 2rem; + width: 99vw; + margin: 0 0.5vw; text-align: center; } \ No newline at end of file