diff --git a/src/App.css b/src/App.css
index 92f956e..dfb93ed 100644
--- a/src/App.css
+++ b/src/App.css
@@ -3,7 +3,7 @@
}
.App-logo {
- animation: App-logo-spin infinite 20s linear;
+ animation: App-logo-spin infinite 120s linear;
height: 40vmin;
}
@@ -30,3 +30,45 @@
transform: rotate(360deg);
}
}
+
+.status {
+ margin-bottom: 10px;
+}
+
+.board-row:after {
+ clear: both;
+ content: "";
+ display: table;
+}
+
+.square {
+ background: #fff;
+ border: 1px solid #999;
+ float: left;
+ font-size: 24px;
+ font-weight: bold;
+ line-height: 34px;
+ height: 34px;
+ margin-right: -1px;
+ margin-top: -1px;
+ padding: 0;
+ text-align: center;
+ width: 34px;
+}
+
+.square:focus {
+ outline: none;
+}
+
+.game {
+ display: flex;
+ flex-direction: row;
+}
+.game {
+ display: flex;
+ flex-direction: row;
+}
+
+.game-info {
+ margin-left: 20px;
+}
\ No newline at end of file
diff --git a/src/App.js b/src/App.js
index 7e261ca..140d175 100644
--- a/src/App.js
+++ b/src/App.js
@@ -1,24 +1,17 @@
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
+import GameComponent from './GameComponent';
+import SquareComponent from './SquareComponent';
+import BoardComponent from './BoardComponent';
class App extends Component {
render() {
return (
);
diff --git a/src/BoardComponent.jsx b/src/BoardComponent.jsx
new file mode 100644
index 0000000..4259464
--- /dev/null
+++ b/src/BoardComponent.jsx
@@ -0,0 +1,60 @@
+import React, { Component } from 'react';
+import SquareComponent from "./SquareComponent";
+
+export default class BoardComponent extends Component{
+
+ constructor(props) {
+ super(props);
+ this.state = {
+ grid: Array(9).fill(null),
+ player: "X",
+ };
+ }
+
+ handleClick(index) {
+ const grid = [...this.state.grid];
+ grid[index] = this.state.player;
+
+ if(this.state.player === 'X'){
+ this.setState({player: 'O'});
+ }
+ else{
+ this.setState({player: 'X'});
+ }
+ this.setState({ grid });
+ }
+
+
+
+ renderCell(index) {
+ return this.handleClick(index)}
+ />;
+ }
+
+ render() {
+ const status = 'Next player:' + this.state.player + '';
+ return (
+
+
{status}
+
+ { this.renderCell(0) }
+ { this.renderCell(1) }
+ { this.renderCell(2) }
+
+
+ { this.renderCell(3) }
+ { this.renderCell(4) }
+ { this.renderCell(5) }
+
+
+ { this.renderCell(6) }
+ { this.renderCell(7) }
+ { this.renderCell(8) }
+
+
+ );
+ }
+
+}
\ No newline at end of file
diff --git a/src/GameComponent.jsx b/src/GameComponent.jsx
new file mode 100644
index 0000000..4e5b44d
--- /dev/null
+++ b/src/GameComponent.jsx
@@ -0,0 +1,18 @@
+import React, { Component } from 'react';
+import BoardComponent from "./BoardComponent";
+
+export default class GameComponent extends Component{
+
+ render() {
+ return (
+
+
+
+
{/* status */}
+
{/* TODO */}
+
+
+ );
+ }
+
+}
\ No newline at end of file
diff --git a/src/SquareComponent.jsx b/src/SquareComponent.jsx
new file mode 100644
index 0000000..2f9eea2
--- /dev/null
+++ b/src/SquareComponent.jsx
@@ -0,0 +1,23 @@
+import React, { Component } from 'react';
+
+export default class SquareComponent extends Component{
+
+ getStyle() {
+ return {
+ cursor: this.props.value ? 'default' : 'pointer'
+ }
+ }
+
+ render() {
+ return (
+
+ );
+ }
+
+}
\ No newline at end of file