Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tailwinds User Delete Dialog #5655

Merged
merged 4 commits into from
Jun 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 14 additions & 40 deletions src/Components/Users/UserDeleteDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
import React, { useState } from "react";
import {
Dialog,
DialogContent,
DialogContentText,
DialogActions,
Button,
} from "@material-ui/core";
import ConfirmDialogV2 from "../Common/ConfirmDialogV2";

interface ConfirmDialogProps {
name: string;
Expand All @@ -14,39 +7,20 @@ interface ConfirmDialogProps {
}

const UserDeleteDialog = (props: ConfirmDialogProps) => {
const { name, handleCancel, handleOk } = props;

const [disable, setDisable] = useState(false);

const handleSubmit = () => {
handleOk();
setDisable(true);
};
return (
<Dialog open={true} maxWidth={"md"} onClose={handleCancel}>
<DialogContent>
<DialogContentText
id="alert-dialog-description"
className="flex text-gray-800 leading-relaxed"
>
<div className="justify-center">
Are you sure you want to delete user <strong>{name}</strong> ?
</div>
</DialogContentText>
</DialogContent>
<DialogActions>
<Button onClick={handleCancel} color="primary">
Cancel
</Button>
<button
onClick={handleSubmit}
className="font-medium btn btn-danger"
disabled={disable}
>
Delete
</button>
</DialogActions>
</Dialog>
<ConfirmDialogV2
title="Delete User"
description={
<span>
Are you sure you want to delete user <strong>{props.name}</strong> ?
</span>
}
action="Delete"
variant="danger"
show
onConfirm={props.handleOk}
onClose={props.handleCancel}
/>
);
};

Expand Down