forked from AdaGold/exquisite-react
-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathFinalPoem.js
40 lines (32 loc) · 1014 Bytes
/
FinalPoem.js
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
import React from 'react';
import PropTypes from 'prop-types';
import './FinalPoem.css';
const FinalPoem = (props) => {
// variables
const revealState = props.revealState
// creat list of all submissions
const finalPoem = props.submissions.map(sentence => {
return <p>{sentence}</p>
})
// event handler
const onPoemReveal = () => {
props.onRevealPoemCallback(revealState)
}
return (
<div className="FinalPoem">
<section className={revealState ? 'FinalPoem__poem' : 'hide FinalPoem__poem'}>
<h3>Final Poem</h3>
{finalPoem}
</section>
<div className="FinalPoem__reveal-btn-container">
<input type="button" value="We are finished: Reveal the Poem" className="FinalPoem__reveal-btn" onClick={onPoemReveal}/>
</div>
</div>
);
}
FinalPoem.propTypes = {
isSubmitted: PropTypes.bool.isRequired,
submissions: PropTypes.arrayOf(PropTypes.string).isRequired,
revealPoem: PropTypes.func.isRequired,
};
export default FinalPoem;