UNPKG

urbi-exhibitions

Version:
39 lines (38 loc) 1.12 kB
import { Map } from '@2gis/mapgl/types'; export interface QuizOption { value: string; label: string; } export interface QuizQuestion { id: number | string; label: string; options: QuizOption[]; correctOption: string; ifAnswerWrongDescription?: string; ifAnswerCorrectDescription?: string; onQuestionOpen?: (map: Map) => Promise<void> | void; onQuestionClose?: (map: Map) => Promise<void> | void; onQuestionAnswer?: (map: Map, answer: string) => Promise<void> | void; } export interface QuizConfig { questions: QuizQuestion[]; } export interface QuizContextProps { currentQuestionIndex: number; answers: Record<string | number, string>; questions: QuizQuestion[]; config: QuizConfig; isStarted: boolean; isCompleted: boolean; isLastQuestion: boolean; isFirstQuestion: boolean; goToNextQuestion: () => void; answerQuestion: (answer: string) => void; getCurrentQuestion: () => QuizQuestion | undefined; getScore: () => { correct: number; total: number; }; restart: () => void; startQuiz: () => void; }