import Tex from '../Tex' import type { Question } from '../../types' interface Props { q: Question value: string | null | undefined onChange: (val: string) => void locked?: boolean graded?: boolean } export default function MultipleChoice({ q, value, onChange, locked, graded }: Props) { return (
{(q.choices ?? []).map((c, i) => { const isSelected = value === c.id let cls = 'choice' if (isSelected) cls += ' selected' if (graded) { if (c.id === q.answer) cls += ' correct' else if (isSelected) cls += ' wrong' } return ( ) })}
) }