-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #419 from project-icp/jf/form-success-modal
Flash success message modal after any survey succeeds
- Loading branch information
Showing
7 changed files
with
78 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/icp/apps/beekeepers/js/src/components/SuccessModal.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import React from 'react'; | ||
import { bool, func } from 'prop-types'; | ||
import Popup from 'reactjs-popup'; | ||
import { connect } from 'react-redux'; | ||
|
||
import { closeSuccessModal } from '../actions'; | ||
|
||
const SuccessModal = ({ dispatch, isSuccessModalOpen }) => ( | ||
<Popup open={isSuccessModalOpen} onClose={() => dispatch(closeSuccessModal())} modal> | ||
{close => ( | ||
<div className="authModal"> | ||
<div className="authModal__header"> | ||
Thank You | ||
<button type="button" className="button" onClick={close}> | ||
× | ||
</button> | ||
</div> | ||
<div className="authModal__content"> | ||
Your response has been saved. | ||
</div> | ||
</div> | ||
)} | ||
</Popup> | ||
); | ||
|
||
function mapStateToProps(state) { | ||
return { | ||
isSuccessModalOpen: state.main.isSuccessModalOpen, | ||
dispatch: state.main.dispatch, | ||
}; | ||
} | ||
|
||
SuccessModal.propTypes = { | ||
isSuccessModalOpen: bool.isRequired, | ||
dispatch: func.isRequired, | ||
}; | ||
|
||
export default connect(mapStateToProps)(SuccessModal); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters