Skip to content

Commit 556c0e6

Browse files
committed
10-results-skeleton
1 parent 80ae361 commit 556c0e6

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

app/components/Battle.jsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as React from "react";
22
import PropTypes from "prop-types";
33
import { close } from "./icons";
4+
import Results from "./Results";
45

56
function Instructions() {
67
return (
@@ -102,6 +103,7 @@ export default class Battle extends React.Component {
102103
this.state = {
103104
playerOne: null,
104105
playerTwo: null,
106+
battle: false,
105107
};
106108

107109
this.handleSubmit = this.handleSubmit.bind(this);
@@ -118,14 +120,23 @@ export default class Battle extends React.Component {
118120
});
119121
}
120122
render() {
121-
const { playerOne, playerTwo } = this.state;
123+
const { playerOne, playerTwo, battle } = this.state;
122124
const disabled = !playerOne || !playerTwo;
123125

126+
if (battle === true) {
127+
return <Results playerOne={playerOne} playerTwo={playerTwo} />;
128+
}
129+
124130
return (
125131
<main className="stack main-stack animate-in">
126132
<div className="split">
127133
<h1>Players</h1>
128-
<button className={`btn primary ${disabled ? "disabled" : ""}`}>
134+
<button
135+
onClick={() => {
136+
this.setState({ battle: true });
137+
}}
138+
className={`btn primary ${disabled ? "disabled" : ""}`}
139+
>
129140
Battle
130141
</button>
131142
</div>

app/components/Results.jsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import * as React from "react";
2+
3+
export default class Results extends React.Component {
4+
render() {
5+
return (
6+
<div>
7+
Results
8+
<pre>{JSON.stringify(this.props, null, 2)}</pre>
9+
</div>
10+
);
11+
}
12+
}

0 commit comments

Comments
 (0)