Put more of color-handling into JS code
This commit is contained in:
parent
96eec63757
commit
1a83641e22
|
@ -38,7 +38,6 @@ ol, ul {
|
|||
}
|
||||
|
||||
.square:focus {
|
||||
background: #8d98e6;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ function Square(props) {
|
|||
let bg = {
|
||||
backgroundImage: `url(${Images[props.value]})`,
|
||||
backgroundSize: `11vw`,
|
||||
// backgroundColor: "lightblue",
|
||||
backgroundColor: props.bg,
|
||||
};
|
||||
if (props.value != null) {
|
||||
return (
|
||||
|
@ -353,10 +353,13 @@ class Board extends React.Component {
|
|||
}
|
||||
|
||||
renderSquare(i) {
|
||||
let bgColor = this.heldPiece() === i ?
|
||||
"#5D98E6" : "white";
|
||||
return (
|
||||
<Square
|
||||
value={this.state.squares[i]}
|
||||
onClick={() => this.handleClick(i)}
|
||||
bg={bgColor}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue