forked from AdaGold/exquisite-react
-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathFinalPoem.js
More file actions
43 lines (37 loc) · 1.1 KB
/
FinalPoem.js
File metadata and controls
43 lines (37 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import React from 'react';
import './FinalPoem.css';
import PropTypes from 'prop-types';
const FinalPoem = (props) => {
const revealPoemButton =
<div className="FinalPoem__reveal-btn-container">
<input
type="button"
value="We are finished: Reveal the Poem"
className="FinalPoem__reveal-btn"
onClick={ props.revealPoem } />
</div>
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 <p key={i}> {sentence}</p>;
}
);
const Poem =
<div className="FinalPoem">
<section className="FinalPoem__poem">
<h3>Final Poem</h3>
<ul>
{submissionsCollection}
</ul>
</section>
</div>;
return (
props.showPoem ? Poem : revealPoemButton
);
};
FinalPoem.propTypes = {
poem: PropTypes.array.isRequired,
revealPoem: PropTypes.func.isRequired,
showPoem: PropTypes.bool.isRequired
}
export default FinalPoem;