Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
chess-game
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
佚名
chess-game
Commits
8157687b
Commit
8157687b
authored
Jul 17, 2019
by
佚名
🎅🏼
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: bg color
parent
2cd2423d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
1 deletion
+7
-1
Square.js
src/components/Square.js
+1
-0
style.js
src/components/style.js
+6
-0
game.js
src/models/game.js
+0
-1
No files found.
src/components/Square.js
View file @
8157687b
...
...
@@ -5,6 +5,7 @@ import { Button } from './style';
const
Square
=
(
props
)
=>
{
return
(
<
Button
className
=
{
props
.
value
===
'
X
'
?
'
blue
'
:
props
.
value
===
'
O
'
?
'
red
'
:
''
}
onClick
=
{
props
.
onClick
}
>
{
props
.
value
}
...
...
src/components/style.js
View file @
8157687b
...
...
@@ -16,6 +16,12 @@ export const Button = styled.button`
&:focus {
outline: none
}
&.blue {
background: blue;
}
&.red {
background: red;
}
`
export
const
BoardRow
=
styled
.
div
`
...
...
src/models/game.js
View file @
8157687b
...
...
@@ -38,7 +38,6 @@ export default {
const
history
=
state
.
history
.
slice
(
0
,
state
.
stepNumber
+
1
);
const
current
=
history
[
history
.
length
-
1
];
const
squares
=
current
.
squares
.
slice
();
console
.
log
(
action
.
payload
)
if
(
calculateWinner
(
squares
)
||
squares
[
action
.
payload
])
{
return
{...
state
};
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment