-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathSurveyFormReview.js
More file actions
46 lines (42 loc) · 1.18 KB
/
SurveyFormReview.js
File metadata and controls
46 lines (42 loc) · 1.18 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
44
45
46
// SurveyFormReview shows users their form inputs for review
import _ from 'lodash';
import React from 'react';
import { connect } from 'react-redux';
import formFields from './formFields';
import { withRouter } from 'react-router-dom';
import * as actions from '../../actions';
const SurveyFormReview = ({ onCancel, formValues, submitSurvey, history }) => {
const reviewFields = _.map(formFields, ({ name, label }) => {
return (
<div key={name}>
<label>{label}</label>
<div>
{formValues[name]}
</div>
</div>
);
});
return (
<div>
<h5>Please confirm your entries</h5>
{reviewFields}
<button
className="yellow darken-3 white-text btn-flat"
onClick={onCancel}
>
Back
</button>
<button
onClick={() => submitSurvey(formValues, history)}
className="green btn-flat right white-text"
>
Send Survey
<i className="material-icons right">email</i>
</button>
</div>
);
};
function mapStateToProps(state) {
return { formValues: state.form.surveyForm.values };
}
export default connect(mapStateToProps, actions)(withRouter(SurveyFormReview));