Add component

This commit is contained in:
2025-09-17 12:17:14 +07:00
parent b25aaf124c
commit 4a3ae20b84
19 changed files with 2074 additions and 0 deletions

View File

@@ -0,0 +1,69 @@
import Swal from 'sweetalert2';
const NotifAlert = ({ icon, title, message }) => {
Swal.fire({
icon: icon,
title: title,
text: message,
showConfirmButton: false,
position: 'center',
timer: 2000,
});
};
const NotifOk = ({ icon, title, message }) => {
Swal.fire({
icon: icon,
title: title,
text: message,
});
};
const NotifConfirmDialog = ({
icon,
title,
message,
onConfirm,
onCancel,
confirmButtonText = 'Hapus',
}) => {
Swal.fire({
icon: icon,
title: title,
text: message,
showCancelButton: true,
cancelButtonColor: '#23A55A',
cancelButtonText: 'Batal',
confirmButtonColor: '#d33000',
confirmButtonText: confirmButtonText,
reverseButtons: true,
}).then((result) => {
if (result.isConfirmed) {
onConfirm();
} else if (result.dismiss) {
onCancel();
}
});
};
const QuestionConfirmSubmit = ({ icon, title, message, onConfirm, onCancel }) => {
Swal.fire({
icon: icon,
title: title,
text: message,
showCancelButton: true,
cancelButtonColor: '#23A55A',
cancelButtonText: 'Batal',
confirmButtonColor: '#d33000',
confirmButtonText: 'Proses',
reverseButtons: true,
}).then((result) => {
if (result.isConfirmed) {
onConfirm();
} else if (result.dismiss) {
onCancel();
}
});
};
export { NotifAlert, NotifOk, NotifConfirmDialog, QuestionConfirmSubmit };