import React from 'react';
import { Button } from '../ui/Button';

interface FormActionsProps {
    onCancel?: () => void;
    cancelLabel?: string;
    submitLabel?: string;
    isLoading?: boolean;
    isDisabled?: boolean;
    className?: string;
}

export const FormActions: React.FC<FormActionsProps> = ({
    onCancel,
    cancelLabel = 'انصراف',
    submitLabel = 'ذخیره',
    isLoading = false,
    isDisabled = false,
    className = '',
}) => {
    return (
        <div className={`flex justify-end space-x-4 space-x-reverse pt-6 border-t border-gray-200 dark:border-gray-600 ${className}`}>
            {onCancel && (
                <Button
                    type="button"
                    variant="secondary"
                    onClick={onCancel}
                    disabled={isLoading}
                >
                    {cancelLabel}
                </Button>
            )}
            <Button
                type="submit"
                loading={isLoading}
                disabled={isDisabled || isLoading}
            >
                {submitLabel}
            </Button>
        </div>
    );
};

