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
36 lines (31 loc) · 885 Bytes
/
FinalPoem.js
File metadata and controls
36 lines (31 loc) · 885 Bytes
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
import React from 'react';
import PropTypes from 'prop-types';
import './FinalPoem.css';
const FinalPoem = (props) => {
let formattedPoem = props.poem.map((line, i) => {
return <p key={i}> {line} </p>;
})
const onClickTogglePoem = () => {
props.togglePoemCallback();
}
return (
(props.showPoem ?
(<div className="FinalPoem">
<section className="FinalPoem__poem">
<h3>Final Poem</h3>
{formattedPoem}
</section>
</div>)
:
(<div className="FinalPoem__reveal-btn-container">
<input type="button" value="We are finished: Reveal the Poem" className="FinalPoem__reveal-btn" onClick={onClickTogglePoem}/>
</div>)
)
)
}
FinalPoem.propTypes = {
poem: PropTypes.arrayOf(PropTypes.string),
showPoem: PropTypes.func.isRequired,
togglePoemCallback: PropTypes.func.isRequired,
}
export default FinalPoem;