import { RefreshCw } from "lucide-react";

interface AllTransactionsActionsProps {
  isLoading: boolean;
  onRefresh: () => void;
}

export const AllTransactionsActions = ({ isLoading, onRefresh }: AllTransactionsActionsProps) => {
  const actionButtonClass = (disabled: boolean) =>
    disabled
      ? "inline-flex items-center gap-1 rounded-lg border border-gray-200 bg-gray-100 px-2 py-1 text-xs font-medium text-gray-500 shadow-sm transition-all duration-200 cursor-not-allowed"
      : "inline-flex items-center gap-1 rounded-lg border border-[#428B4D]/40 bg-white px-2 py-1 text-xs font-semibold text-slate-700 shadow-sm transition-all duration-200 hover:-translate-y-0.5 hover:border-[#428B4D] hover:bg-[#428B4D] hover:text-white focus:outline-none focus-visible:ring-2 focus-visible:ring-[#428B4D]/40 active:scale-95";

  return (
    <button
      onClick={onRefresh}
      disabled={isLoading}
      className={actionButtonClass(isLoading)}
    >
      <RefreshCw size={16} className={isLoading ? "animate-spin" : ""} />
      {isLoading ? "Refreshing..." : "Refresh"}
    </button>
  );
};
