Download src/components/question-creation/QuestionParameterForm.tsx from Hoooong/QuizFlash: direct link, hf CLI and curl.
- Browser
- Download file 1.16 kB
-
https://huggingface.co/spaces/Hoooong/QuizFlash/resolve/main/src/components/question-creation/QuestionParameterForm.tsx
- Command line
-
hf download hf://spaces/Hoooong/QuizFlash/src/components/question-creation/QuestionParameterForm.tsx
-
curl -L -o QuestionParameterForm.tsx https://huggingface.co/spaces/Hoooong/QuizFlash/resolve/main/src/components/question-creation/QuestionParameterForm.tsx
1.16 kB
| 'use client'; | |
| import { QuestionType, QuestionParameters } from '@/types/quiz'; | |
| import { questionTypeConfigs, defaultQuestionTypeConfig } from '@/config/questionTypes'; | |
| import ParameterInput from './ParameterInput'; | |
| interface QuestionParameterFormProps { | |
| questionType: QuestionType; | |
| parameters: QuestionParameters; | |
| onParametersChange: (parameters: QuestionParameters) => void; | |
| } | |
| export default function QuestionParameterForm({ | |
| questionType, | |
| parameters, | |
| onParametersChange, | |
| }: QuestionParameterFormProps) { | |
| const updateParameter = (key: string, value: string | number | boolean | string[]) => { | |
| onParametersChange({ ...parameters, [key]: value }); | |
| }; | |
| // Get configuration for this question type, fallback to default | |
| const config = questionTypeConfigs[questionType.id] || defaultQuestionTypeConfig; | |
| return ( | |
| <div className="space-y-4"> | |
| {config.parameters.map((paramConfig) => ( | |
| <ParameterInput | |
| key={paramConfig.key} | |
| config={paramConfig} | |
| value={parameters[paramConfig.key]} | |
| onChange={(value) => updateParameter(paramConfig.key, value)} | |
| /> | |
| ))} | |
| </div> | |
| ); | |
| } |