Add react-modal, replace confirm usage with it
This commit is contained in:
parent
63cf65100d
commit
0085cea5a1
17 changed files with 443 additions and 152 deletions
27
client/js/components/modals/Confirm.js
Normal file
27
client/js/components/modals/Confirm.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
import React, { useCallback } from 'react';
|
||||
import withModal from 'components/modals/withModal';
|
||||
import Button from 'components/ui/Button';
|
||||
|
||||
const Confirm = ({
|
||||
payload: { question, confirmation, onConfirm },
|
||||
onClose
|
||||
}) => {
|
||||
const handleConfirm = useCallback(() => {
|
||||
onClose(false);
|
||||
onConfirm();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
<p>{question}</p>
|
||||
<Button onClick={handleConfirm}>{confirmation || 'OK'}</Button>
|
||||
<Button category="normal" onClick={onClose}>
|
||||
Cancel
|
||||
</Button>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default withModal({
|
||||
name: 'confirm'
|
||||
})(Confirm);
|
Loading…
Add table
Add a link
Reference in a new issue