import { SingleChoice } from "@/components";
import { getBackgroundImage } from "@/lib/utils";
import type { QuizPanelProps } from "./types";
/** 单选题展示面板:题干使用“底板”背景,点击即选,hover 高亮 */
const QuizPanel = ({
visible,
zIndex = 10000,
title,
options,
value,
error,
onChange,
}: QuizPanelProps) => {
if (!visible) return null;
return (
{/* 题干卡片 */}
{/* 选项区域 */}
(
onChange?.(option.value)}
>
{
if (isSelected) return;
(e.currentTarget as HTMLDivElement).style.backgroundImage =
getBackgroundImage("components/quiz/选中");
(e.currentTarget as HTMLDivElement).style.filter = "";
}}
onMouseLeave={(e) => {
if (isSelected) return;
(e.currentTarget as HTMLDivElement).style.backgroundImage =
getBackgroundImage("components/quiz/未选择");
(e.currentTarget as HTMLDivElement).style.filter =
"brightness(0.96)";
}}
>
{option.label}
)}
/>
{/* 答案反馈 */}
{error && (
{error}
)}
);
};
export default QuizPanel;