diff --git a/.env b/.env new file mode 100644 index 00000000..44c0ec83 --- /dev/null +++ b/.env @@ -0,0 +1 @@ + SKIP_PREFLIGHT_CHECK=true \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..a7986828 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,18 @@ +{ + "workbench.colorCustomizations": { + "activityBar.background": "#7f40bf", + "activityBar.activeBorder": "#c78f58", + "activityBar.foreground": "#e7e7e7", + "activityBar.inactiveForeground": "#e7e7e799", + "activityBarBadge.background": "#c78f58", + "activityBarBadge.foreground": "#15202b", + "titleBar.activeBackground": "#663399", + "titleBar.inactiveBackground": "#66339999", + "titleBar.activeForeground": "#e7e7e7", + "titleBar.inactiveForeground": "#e7e7e799", + "statusBar.background": "#663399", + "statusBarItem.hoverBackground": "#7f40bf", + "statusBar.foreground": "#e7e7e7" + }, + "peacock.color": "#639" +} \ No newline at end of file diff --git a/src/App.js b/src/App.js index 8e1f9446..6f0e2798 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..2966ac58 100644 --- a/src/components/FinalPoem.js +++ b/src/components/FinalPoem.js @@ -1,20 +1,38 @@ import React from 'react'; import './FinalPoem.css'; -const FinalPoem = (props) => { +// state, props, any callbacks, event handlers, or helper functions (with the exception of Game component). However, not every render function may need to look like that in the end result. In fact, it is expected that the render functions change in order to accommodate the requirements (namely the ones about conditional rendering). - return ( -
-
-

Final Poem

- -
- -
- +class FinalPoem extends React.Component { + showCompletedPoem = () => { + this.props.showCompletedPoemCallBack() + } + + render() { + const pressButton = +
+ +
+ const fullPoem = this.props.fullPoem.map((line, i) => { + return ( +
+

The {line.adjective} {line.noun} {line.adverb} {line.verb} the {line.adjective2} {line.noun2}. +

-
- ); + ) + }) + + return ( +
+
+

Final Poem

+
+ { this.props.showPoemStatus ? fullPoem : pressButton } +
+
+
+ + ); + } } - export default FinalPoem; diff --git a/src/components/Game.js b/src/components/Game.js index e99f985a..205b40b2 100644 --- a/src/components/Game.js +++ b/src/components/Game.js @@ -8,8 +8,31 @@ class Game extends Component { constructor(props) { super(props); + + this.state = { + completedPoem: [], + poemSubmitted: false, + showForm: true + } + } + + showCompletedPoem = () => { + const itShows = this.state.showForm + this.setState({ + poemSubmitted: true, + showForm: !itShows + }) } + addVerse = (singlePoemVerse) => { + let lines = this.state.completedPoem; + + lines.push(singlePoemVerse); + this.setState({ + lines + }); + } + render() { const exampleFormat = FIELDS.map((field) => { @@ -20,6 +43,8 @@ class Game extends Component { } }).join(" "); + + return (

Game

@@ -32,12 +57,18 @@ class Game extends Component { { exampleFormat }

- + { this.state.showForm ? +
+ - - - + +
: null + } +
); } diff --git a/src/components/PlayerSubmissionForm.js b/src/components/PlayerSubmissionForm.js index 1de05095..dbf6d768 100644 --- a/src/components/PlayerSubmissionForm.js +++ b/src/components/PlayerSubmissionForm.js @@ -5,25 +5,96 @@ class PlayerSubmissionForm extends Component { constructor(props) { super(props); + + this.state = { + adjective: '', + noun: '', + adverb: '', + verb: '', + adjective2: '', + noun2: '', + } + } + + //abstraction of whats being allocated to their proper place + onPoemInputChange = (event) => { + console.log(event); + const updatedState = {}; //updatedstate IS field + + updatedState[event.target.name] = event.target.value; + + this.setState(updatedState); //setting state of field + } + + //sendSubmission this is the callback submitting form that calls the callaback function + onSubmit = (event) => { + event.preventDefault(); + + this.props.addVerseCallBack({ + adjective: this.state.adjective, + noun: this.state.noun, + adverb: this.state.adverb, + verb: this.state.verb, + adjective2: this.state.adjective2, + noun2: this.state.noun2, + }); + + this.setState({ + adjective: '', + noun: '', + adverb: '', + verb: '', + adjective2: '', + noun2: '', + }); } render() { + return (
-

Player Submission Form for Player #{ }

- -
+

Player Submission Form for Player #{ this.props.player +1 }

+ +
- - { - // Put your form inputs here... We've put in one below as an example - } - + name="adjective" + placeholder="adjective" + onChange={this.onPoemInputChange} + value={this.state.adjective} + /> + + + + +
diff --git a/src/components/RecentSubmission.js b/src/components/RecentSubmission.js index 663da34b..255dca82 100644 --- a/src/components/RecentSubmission.js +++ b/src/components/RecentSubmission.js @@ -2,12 +2,18 @@ import React from 'react'; import './RecentSubmission.css'; const RecentSubmission = (props) => { + if (props.lastVerse) { + return (

The Most Recent Submission

-

{ }

+

The {props.lastVerse.adjective} {props.lastVerse.noun} {props.lastVerse.adverb} {props.lastVerse.verb} the {props.lastVerse.adjective2} {props.lastVerse.noun2}. +

); -} +} else { + return null +}} export default RecentSubmission;