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 flex-col-reverse sm:flex-row justify-end gap-3 sm:space-x-4 sm: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}
                    className="w-full sm:w-auto"
                >
                    {cancelLabel}
                </Button>
            )}
            <Button
                type="submit"
                loading={isLoading}
                disabled={isDisabled || isLoading}
                className="w-full sm:w-auto"
            >
                {submitLabel}
            </Button>
        </div>
    );
};

