import { EyeIcon, PencilSquareIcon, TrashIcon } from '@heroicons/react/24/solid';

interface RowActionsProps {
    onView?: () => void;
    onEdit?: () => void;
    onDelete?: () => void;
    editLabel?: string;
}

export function RowActions({ onView, onEdit, onDelete, editLabel = 'Edit' }: RowActionsProps) {
    return (
        <div className="flex gap-1.5">
            {onView && (
                <button
                    type="button"
                    onClick={onView}
                    title="Lihat"
                    className="p-1.5 rounded-md bg-sky-500 text-white hover:bg-sky-600 cursor-pointer"
                >
                    <EyeIcon className="w-4 h-4" />
                </button>
            )}
            {onEdit && (
                <button
                    type="button"
                    onClick={onEdit}
                    title={editLabel}
                    className="p-1.5 rounded-md bg-amber-500 text-white hover:bg-amber-600 cursor-pointer"
                >
                    <PencilSquareIcon className="w-4 h-4" />
                </button>
            )}
            {onDelete && (
                <button
                    type="button"
                    onClick={onDelete}
                    title="Hapus"
                    className="p-1.5 rounded-md bg-red-600 text-white hover:bg-red-700 cursor-pointer"
                >
                    <TrashIcon className="w-4 h-4" />
                </button>
            )}
        </div>
    );
}
