"use client";
import { useTranslation } from "react-i18next";
import { cn } from "@/lib/utils";
import { DollarOutlined, BarChartOutlined } from "@ant-design/icons";
import { motion } from "framer-motion";
interface MetricToggleProps {
value: "cost" | "count";
onChange: (value: "cost" | "count") => void;
className?: string;
}
export function MetricToggle({
value,
onChange,
className,
}: MetricToggleProps) {
const { t } = useTranslation("common");
return (
onChange("cost")}
className={cn(
"relative flex-1 flex items-center justify-center gap-1.5 px-4 py-2 text-sm font-medium rounded-md",
"transition-colors duration-200",
value === "cost"
? "text-gray-900"
: "text-gray-500 hover:text-gray-700"
)}
>
{value === "cost" && (
)}
{t("panel.byAmount")}
onChange("count")}
className={cn(
"relative flex-1 flex items-center justify-center gap-1.5 px-4 py-2 text-sm font-medium rounded-md",
"transition-colors duration-200",
value === "count"
? "text-gray-900"
: "text-gray-500 hover:text-gray-700"
)}
>
{value === "count" && (
)}
{t("panel.byCount")}
);
}