TKK_E32231405/lib/swal.ts

48 lines
1.7 KiB
TypeScript

import Swal from 'sweetalert2'
export const showSwal = {
success: (title: string, text?: string) => {
return Swal.fire({
title,
text,
icon: 'success',
confirmButtonColor: '#000000',
background: '#ffffff',
customClass: {
popup: 'border-2 border-black shadow-[8px_8px_0px_0px_rgba(0,0,0,1)] rounded-2xl',
confirmButton: 'px-8 py-3 bg-black text-white font-bold rounded-xl hover:bg-gray-800 transition-all'
}
})
},
error: (title: string, text?: string) => {
return Swal.fire({
title,
text,
icon: 'error',
confirmButtonColor: '#000000',
customClass: {
popup: 'border-2 border-black shadow-[8px_8px_0px_0px_rgba(0,0,0,1)] rounded-2xl',
confirmButton: 'px-8 py-3 bg-black text-white font-bold rounded-xl'
}
})
},
confirm: (title: string, text?: string) => {
return Swal.fire({
title,
text,
icon: 'question',
showCancelButton: true,
confirmButtonText: 'Ya, Lanjutkan',
cancelButtonText: 'Batal',
confirmButtonColor: '#000000',
cancelButtonColor: '#ffffff',
customClass: {
popup: 'border-2 border-black shadow-[8px_8px_0px_0px_rgba(0,0,0,1)] rounded-2xl',
confirmButton: 'px-8 py-3 bg-black text-white font-bold rounded-xl mr-2',
cancelButton: 'px-8 py-3 border-2 border-black text-black font-bold rounded-xl hover:bg-gray-50'
},
buttonsStyling: false
})
}
}