import type { ReactNode } from "react";
import Button from "../Button";
import { usePlatformLanguage } from "../../i18n/LanguageContext";

type Props = {
  label: string;
  icon: ReactNode;
  onClick?: () => void;
  disabled?: boolean;
  variant?: "primary" | "secondary" | "ghost" | "danger";
};

export default function AdminIconButton({ label, icon, onClick, disabled = false, variant = "secondary" }: Props) {
  const { translateText } = usePlatformLanguage();
  const translatedLabel = translateText(label);
  return (
    <Button
      type="button"
      variant={variant}
      className="admin-icon-button"
      aria-label={translatedLabel}
      title={translatedLabel}
      disabled={disabled}
      onClick={onClick}
    >
      {icon}
    </Button>
  );
}
