diff --git a/src/App.js b/src/App.js
index 8e1f9446..b8572ca0 100644
--- a/src/App.js
+++ b/src/App.js
@@ -3,6 +3,7 @@ import './App.css';
import Game from './components/Game.js';
class App extends Component {
+
render() {
return (
diff --git a/src/components/FinalPoem.js b/src/components/FinalPoem.js
index d516184e..6da53f11 100644
--- a/src/components/FinalPoem.js
+++ b/src/components/FinalPoem.js
@@ -1,20 +1,43 @@
import React from 'react';
import './FinalPoem.css';
+import PropTypes from 'prop-types';
const FinalPoem = (props) => {
+ const revealPoemButton =
+
+
+
+
+ const submissionsCollection = props.poem.map((submission, i) => {
+ const { adjective, noun, adverb, verb, adjective2, noun2 } = submission
+ const sentence = `The ${adjective} ${noun} ${adverb} ${verb} the ${adjective2} ${noun2}.`
+ return
{sentence}
;
+ }
+ );
- return (
+ const Poem =
Final Poem
-
+
+ {submissionsCollection}
+
+
;
+
+ return (
+ props.showPoem ? Poem : revealPoemButton
+ );
+};
-
-
-
-
- );
+FinalPoem.propTypes = {
+ poem: PropTypes.array.isRequired,
+ revealPoem: PropTypes.func.isRequired,
+ showPoem: PropTypes.bool.isRequired
}
-
-export default FinalPoem;
+
+export default FinalPoem;
\ No newline at end of file
diff --git a/src/components/Game.js b/src/components/Game.js
index e99f985a..47625b9c 100644
--- a/src/components/Game.js
+++ b/src/components/Game.js
@@ -6,10 +6,51 @@ import RecentSubmission from './RecentSubmission';
class Game extends Component {
- constructor(props) {
- super(props);
+ constructor() {
+ super();
+
+ this.state = {
+ submissions: [],
+ lastSubmission: {},
+ player: 1,
+ showPoem: false,
+ showSubm: false
+ }
+ };
+
+ addSubmission = (submission) => {
+
+ const submissions = this.state.submissions;
+
+ submissions.push(submission);
+ this.setState({
+ submissions,
+ player: this.state.player + 1,
+ showSubm: true,
+ })
+ };
+
+ lastSubmission = (submission) => {
+
+ let { lastSubmission } = this.state.lastSubmission;
+
+ lastSubmission = submission
+ this.setState({
+ lastSubmission,
+ });
}
+ revealPoem = (event) => {
+ event.preventDefault();
+ if (this.state.submissions.length > 0) {
+ this.setState({
+ showPoem: true,
+ showSubm: false,
+ });
+ };
+ };
+
+
render() {
const exampleFormat = FIELDS.map((field) => {
@@ -32,12 +73,23 @@ class Game extends Component {
{ exampleFormat }
-