mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-06 21:57:14 +02:00
36 lines
831 B
JavaScript
36 lines
831 B
JavaScript
import React from 'react';
|
|
import Square from './square';
|
|
import styles from './styles.css';
|
|
|
|
export default class Board extends React.Component {
|
|
renderSquare(i) {
|
|
return (
|
|
<Square
|
|
value={this.props.squares[i]}
|
|
onClick={() => this.props.onClick(i)}
|
|
/>
|
|
);
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<div>
|
|
<div className={styles.boardRow}>
|
|
{this.renderSquare(0)}
|
|
{this.renderSquare(1)}
|
|
{this.renderSquare(2)}
|
|
</div>
|
|
<div className={styles.boardRow}>
|
|
{this.renderSquare(3)}
|
|
{this.renderSquare(4)}
|
|
{this.renderSquare(5)}
|
|
</div>
|
|
<div className={styles.boardRow}>
|
|
{this.renderSquare(6)}
|
|
{this.renderSquare(7)}
|
|
{this.renderSquare(8)}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
}
|