import { Icon } from '@iconify/react'; import { FormikContextType } from 'formik'; import Button from '@/components/Button'; import { cn } from '@/lib/helper'; interface FormActionsProps { type: 'add' | 'edit' | 'detail'; formik: FormikContextType; editUrl?: string; onDelete?: () => void; disableSubmit?: boolean; onApprove?: () => void; onReject?: () => void; isApproveLoading?: boolean; isRejectLoading?: boolean; showApproveReject?: boolean; } export const FormActions = ({ type, formik, editUrl, onDelete, disableSubmit = false, onApprove, onReject, isApproveLoading = false, isRejectLoading = false, showApproveReject = false, }: FormActionsProps) => { return (
{type !== 'add' && (
{onDelete && ( )} {type !== 'edit' && editUrl && ( )} {type === 'detail' && showApproveReject && (onApprove || onReject) && ( <> {onApprove && ( )} {onReject && ( )} )}
)} {type !== 'detail' && (
)}
); };