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 {
|
.square:focus {
|
||||||
background: #8d98e6;
|
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ function Square(props) {
|
||||||
let bg = {
|
let bg = {
|
||||||
backgroundImage: `url(${Images[props.value]})`,
|
backgroundImage: `url(${Images[props.value]})`,
|
||||||
backgroundSize: `11vw`,
|
backgroundSize: `11vw`,
|
||||||
// backgroundColor: "lightblue",
|
backgroundColor: props.bg,
|
||||||
};
|
};
|
||||||
if (props.value != null) {
|
if (props.value != null) {
|
||||||
return (
|
return (
|
||||||
|
@ -353,10 +353,13 @@ class Board extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
renderSquare(i) {
|
renderSquare(i) {
|
||||||
|
let bgColor = this.heldPiece() === i ?
|
||||||
|
"#5D98E6" : "white";
|
||||||
return (
|
return (
|
||||||
<Square
|
<Square
|
||||||
value={this.state.squares[i]}
|
value={this.state.squares[i]}
|
||||||
onClick={() => this.handleClick(i)}
|
onClick={() => this.handleClick(i)}
|
||||||
|
bg={bgColor}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue