add highlight for current turn to PlayerArea bowl
This commit is contained in:
parent
6359089e91
commit
f010d5d9ee
3 changed files with 16 additions and 15 deletions
|
@ -1,43 +1,41 @@
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import "./PlayerArea.scss";
|
import "./PlayerArea.scss";
|
||||||
|
|
||||||
const PlayerArea = ({ playerMeta }) => {
|
const PlayerArea = ({ playerMeta, turn }) => {
|
||||||
// const { user } = props
|
const { stones, player, rank, captures } = playerMeta;
|
||||||
const user = {
|
const isTurn =
|
||||||
stones: "black",
|
(stones === "black" && turn === 1) || (stones === "white" && turn === -1);
|
||||||
username: "Name",
|
|
||||||
captures: 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`player-container player-container--${playerMeta.stones}`}>
|
<div className={`player-container player-container--${stones}`}>
|
||||||
<div
|
<div
|
||||||
className={`player-container__bowl player-container__bowl--${playerMeta.stones}`}
|
className={`player-container__bowl player-container__bowl--${stones}`}
|
||||||
|
{...(isTurn ? { "data-turn": true } : null)}
|
||||||
>
|
>
|
||||||
<p>Pass?</p>
|
<p>Pass?</p>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
className={`player-container__name-space player-container__name-space--${playerMeta.stones}`}
|
className={`player-container__name-space player-container__name-space--${stones}`}
|
||||||
>
|
>
|
||||||
<h4>
|
<h4>
|
||||||
{playerMeta
|
{playerMeta
|
||||||
? `${playerMeta.player} ${playerMeta.rank}`
|
? `${player || stones} ${rank || "?"}`
|
||||||
: "Waiting for player"}
|
: "Waiting for player"}
|
||||||
</h4>
|
</h4>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
className={`player-container__caps-space player-container__caps-space__${playerMeta.stones}`}
|
className={`player-container__caps-space player-container__caps-space__${stones}`}
|
||||||
>
|
>
|
||||||
<p
|
<p
|
||||||
className={`player-container__resign-message player-container__resign-message--${playerMeta.stones}`}
|
className={`player-container__resign-message player-container__resign-message--${stones}`}
|
||||||
>
|
>
|
||||||
Resign?
|
Resign?
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p
|
<p
|
||||||
className={`player-container__caps-counter player-container__caps-counter--${playerMeta.stones}`}
|
className={`player-container__caps-counter player-container__caps-counter--${stones}`}
|
||||||
>
|
>
|
||||||
{playerMeta ? playerMeta.captures : "Captures go here"}
|
{playerMeta ? captures : "Captures go here"}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -47,6 +47,7 @@ div.player-container {
|
||||||
padding: .5em;
|
padding: .5em;
|
||||||
}
|
}
|
||||||
&[data-turn] {
|
&[data-turn] {
|
||||||
|
// highlight for turn
|
||||||
box-shadow: 0 0 3vh 3vh rgb(255, 175, 2);
|
box-shadow: 0 0 3vh 3vh rgb(255, 175, 2);
|
||||||
|
|
||||||
& + .player-container__name-space .player-container__caps-space:hover :first-child {
|
& + .player-container__name-space .player-container__caps-space:hover :first-child {
|
||||||
|
|
|
@ -82,6 +82,7 @@ const Game = (props) => {
|
||||||
? playerBlackMeta
|
? playerBlackMeta
|
||||||
: playerWhiteMeta
|
: playerWhiteMeta
|
||||||
}
|
}
|
||||||
|
turn={state?.meta?.turn}
|
||||||
/>
|
/>
|
||||||
<Board
|
<Board
|
||||||
dispatch={dispatch}
|
dispatch={dispatch}
|
||||||
|
@ -99,6 +100,7 @@ const Game = (props) => {
|
||||||
? playerWhiteMeta
|
? playerWhiteMeta
|
||||||
: playerBlackMeta
|
: playerBlackMeta
|
||||||
}
|
}
|
||||||
|
turn={state?.meta?.turn}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue