Merge branch 'release/0.0.3'
This commit is contained in:
36
src/components/DeleteConfirmation/index.jsx
Normal file
36
src/components/DeleteConfirmation/index.jsx
Normal file
@@ -0,0 +1,36 @@
|
||||
import React from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import {Dialog, DialogTitle, DialogContentText, Button, DialogActions, DialogContent} from '@material-ui/core';
|
||||
|
||||
const DeleteConfirmation = (props) => {
|
||||
return (
|
||||
<div>
|
||||
<Dialog open={props.open}
|
||||
onClose={props.close}>
|
||||
<DialogTitle id="alert-dialog-title">
|
||||
{"Delete Resource?"}
|
||||
</DialogTitle>
|
||||
<DialogContent>
|
||||
<DialogContentText id="alert-dialog-description">
|
||||
{"Are you sure you want to delete: " + props.message}
|
||||
</DialogContentText>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button onClick={props.close}>Cancel</Button>
|
||||
<Button variant="contained" color="secondary" onClick={() => { props.close(); props.deleteFunction()}} autoFocus>
|
||||
Delete
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
DeleteConfirmation.propTypes={
|
||||
open: PropTypes.bool.isRequired, // Boolean that determines if the modal should be open
|
||||
close: PropTypes.func.isRequired, // Function that sets the open state to false i.e. () => setOpen(false)
|
||||
message: PropTypes.any.isRequired, // What the user will see if being confirmed to be deleted
|
||||
deleteFunction: PropTypes.func.isRequired, // Function that runs when user clicks delete
|
||||
}
|
||||
|
||||
export default DeleteConfirmation;
|
||||
Reference in New Issue
Block a user