Checker the board

This commit is contained in:
Sage Vaillancourt 2020-12-28 17:51:09 -05:00
parent 0cd2615959
commit 63dba59d25
2 changed files with 4 additions and 10 deletions

View File

@ -42,6 +42,7 @@ ol, ul {
margin-top: -1px;
padding: 0;
text-align: center;
outline: none;
}
.square:hover {

View File

@ -72,7 +72,6 @@ function Square(props) {
backgroundSize: `100%`,
backgroundColor: props.bg,
};
if (props.value != null) {
return (
<button
className="square"
@ -81,14 +80,6 @@ function Square(props) {
>
</button>
);
} else {
return (
<button
className="square"
onClick={props.onClick}
></button>
);
}
}
class Board extends React.Component {
@ -353,8 +344,10 @@ class Board extends React.Component {
}
renderSquare(i) {
let plainBg = (i + (Math.floor(i / 8))) % 2 === 0 ?
"white" : "#666";
let bgColor = this.heldPiece() === i ?
"#5D98E6" : "white";
"#5D98E6" : plainBg;
return (
<Square
value={this.state.squares[i]}