import clsx from "clsx";
import {IconType} from "react-icons";

interface Props {
	Icon: IconType;
	label: string;
	value: string | number;
	color: "purple" | "rose" | "red";
	onClick?: () => void;
}

export default function IconCard({Icon, label, value, color, onClick}: Props) {
	const colorClasses: {[key in typeof color]: string} = {
		purple: "text-mti-purple-light",
		red: "text-mti-red-light",
		rose: "text-mti-rose-light",
	};

	return (
		<div
			onClick={onClick}
			className="bg-white rounded-xl shadow p-4 flex flex-col gap-4 items-center text-center w-52 h-52 justify-center cursor-pointer hover:shadow-xl transition ease-in-out duration-300">
			<Icon className={clsx("text-6xl", colorClasses[color])} />
			<span className="flex flex-col gap-1 items-center text-xl">
				<span className="text-lg">{label}</span>
				<span className={clsx("font-semibold", colorClasses[color])}>{value}</span>
			</span>
		</div>
	);
}
