fix(types): add isLoading prop to ConfirmModal
All checks were successful
Deploy Canina / deploy (push) Successful in 1m46s
All checks were successful
Deploy Canina / deploy (push) Successful in 1m46s
This commit is contained in:
parent
83dce41715
commit
43f59813b6
@ -9,6 +9,7 @@ interface ConfirmModalProps {
|
||||
confirmText?: string;
|
||||
cancelText?: string;
|
||||
isDestructive?: boolean;
|
||||
isLoading?: boolean;
|
||||
}
|
||||
|
||||
export default function ConfirmModal({
|
||||
@ -19,7 +20,8 @@ export default function ConfirmModal({
|
||||
onCancel,
|
||||
confirmText = 'تایید',
|
||||
cancelText = 'لغو',
|
||||
isDestructive = true
|
||||
isDestructive = true,
|
||||
isLoading = false
|
||||
}: ConfirmModalProps) {
|
||||
if (!isOpen) return null;
|
||||
|
||||
@ -41,17 +43,19 @@ export default function ConfirmModal({
|
||||
<div className="p-4 border-t border-gray-100 bg-gray-50 flex justify-end gap-3">
|
||||
<button
|
||||
onClick={onCancel}
|
||||
className="px-4 py-2 font-bold text-gray-700 bg-white border border-gray-200 rounded-xl hover:bg-gray-50 transition-colors"
|
||||
disabled={isLoading}
|
||||
className="px-4 py-2 font-bold text-gray-700 bg-white border border-gray-200 rounded-xl hover:bg-gray-50 transition-colors disabled:opacity-50"
|
||||
>
|
||||
{cancelText}
|
||||
</button>
|
||||
<button
|
||||
onClick={onConfirm}
|
||||
className={`px-4 py-2 font-bold text-white rounded-xl transition-colors ${
|
||||
disabled={isLoading}
|
||||
className={`px-4 py-2 font-bold text-white rounded-xl transition-colors disabled:opacity-50 flex items-center gap-2 ${
|
||||
isDestructive ? 'bg-red-600 hover:bg-red-700 shadow-md shadow-red-200' : 'bg-purple-600 hover:bg-purple-700 shadow-md shadow-purple-200'
|
||||
}`}
|
||||
>
|
||||
{confirmText}
|
||||
{isLoading ? 'در حال پردازش...' : confirmText}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user