'use client'; import { RefObject } from 'react'; import { Icon } from '@iconify/react'; import Modal from '@/components/Modal'; import Button from '@/components/Button'; import { cn } from '@/lib/helper'; import { Color } from '@/types/theme'; export interface ConfirmationModalProps { ref: RefObject; type?: 'info' | 'success' | 'error'; text?: string; closeOnBackdrop?: boolean; primaryButton?: { text?: string; color?: Color; isLoading?: boolean; onClick?: () => void; }; secondaryButton?: { text?: string; color?: Color; isLoading?: boolean; onClick?: () => void; }; className?: { modal?: string; modalBox?: string; }; children?: React.ReactNode; } const ConfirmationModal = ({ ref, type = 'info', text, closeOnBackdrop, primaryButton, secondaryButton, className, children, }: ConfirmationModalProps) => { const closeModalHandler = () => { ref.current?.close(); }; return (
{type === 'info' && ( )} {type === 'success' && ( )} {type === 'error' && ( )}

{text ?? 'Apakah anda yakin ingin melakukan hal ini?'}

{children &&
{children}
}
{secondaryButton && secondaryButton.text && ( )} {primaryButton && primaryButton.text && ( )}
); }; export default ConfirmationModal;