-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBoard.js
27 lines (26 loc) · 776 Bytes
/
Board.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import React from 'react'
import Square from './Square'
export default class Board extends React.Component {
render () {
return (
<div className='board'>
{[7, 6, 5, 4, 3, 2, 1, 0].map(y =>
<div className='row' key={y}>
{[0, 1, 2, 3, 4, 5, 6, 7].map(x =>
<Square
highlighted={this.props.highlightedSquares
.some(([y2, x2]) => y2 === y && x2 === x)}
showHighlight={this.props.highlights}
y={y}
x={x}
state={this.props.state}
parentCallback={validMove => this.props.parentCallback(y, x, validMove)}
key={x}
/>
)}
</div>
)}
</div>
)
}
}