"use client"; import { motion } from "framer-motion"; import { Check, X } from "lucide-react"; import { useCosmeticContext } from "@/components/cosmetics/CosmeticProvider"; type AnswerState = "idle" | "correct" | "wrong" | "disabled"; interface AnswerButtonProps { text: string; state: AnswerState; onClick: () => void; index: number; showBadge?: boolean; } const LETTER_LABELS = ["A", "B", "C", "D"]; const stateStyles: Record = { idle: "glass-card border-white/20 hover:border-magenta/50 cursor-pointer", correct: "border-green-400 bg-green-500/25 text-white shadow-[0_0_20px_rgba(34,197,94,0.4),0_0_40px_rgba(34,197,94,0.15)]", wrong: "border-red-500 bg-red-500/25 text-red-300 animate-shake shadow-[0_0_20px_rgba(239,68,68,0.4)]", disabled: "border-white/10 opacity-40 cursor-default", }; const badgeStyles: Record = { idle: "bg-white/10", correct: "bg-green-500 text-white", wrong: "bg-red-500 text-white", disabled: "bg-white/5", }; export function AnswerButton({ text, state, onClick, index, showBadge = true }: AnswerButtonProps) { const { equipped } = useCosmeticContext(); const hasAnswerCosmetic = equipped.answer_style !== null; // Apply cosmetic border/hover overrides only when idle and a cosmetic is equipped const cosmeticIdleStyle: React.CSSProperties | undefined = state === "idle" && hasAnswerCosmetic ? { borderColor: "var(--cosmetic-answer-border)" } : undefined; const cosmeticHoverStyle = state === "idle" && hasAnswerCosmetic ? { borderColor: "var(--cosmetic-answer-hover)", boxShadow: `0 0 20px var(--cosmetic-answer-hover)`, } : undefined; return ( {showBadge && ( {state === "correct" ? : state === "wrong" ? : LETTER_LABELS[index] ?? ""} )} {text} ); }