mirror of
https://github.com/formbricks/formbricks.git
synced 2025-12-30 10:19:51 -06:00
66 lines
1.9 KiB
TypeScript
66 lines
1.9 KiB
TypeScript
import { QuestionType, type Question } from "@formbricks/types/questions";
|
|
import OpenTextQuestion from "./OpenTextQuestion";
|
|
import MultipleChoiceSingleQuestion from "./MultipleChoiceSingleQuestion";
|
|
import MultipleChoiceMultiQuestion from "./MultipleChoiceMultiQuestion";
|
|
import NPSQuestion from "./NPSQuestion";
|
|
import CTAQuestion from "./CTAQuestion";
|
|
import RatingQuestion from "./RatingQuestion";
|
|
|
|
interface QuestionConditionalProps {
|
|
question: Question;
|
|
onSubmit: (data: { [x: string]: any }) => void;
|
|
lastQuestion: boolean;
|
|
brandColor: string;
|
|
}
|
|
|
|
export default function QuestionConditional({
|
|
question,
|
|
onSubmit,
|
|
lastQuestion,
|
|
brandColor,
|
|
}: QuestionConditionalProps) {
|
|
return question.type === QuestionType.OpenText ? (
|
|
<OpenTextQuestion
|
|
question={question}
|
|
onSubmit={onSubmit}
|
|
lastQuestion={lastQuestion}
|
|
brandColor={brandColor}
|
|
/>
|
|
) : question.type === QuestionType.MultipleChoiceSingle ? (
|
|
<MultipleChoiceSingleQuestion
|
|
question={question}
|
|
onSubmit={onSubmit}
|
|
lastQuestion={lastQuestion}
|
|
brandColor={brandColor}
|
|
/>
|
|
) : question.type === QuestionType.MultipleChoiceMulti ? (
|
|
<MultipleChoiceMultiQuestion
|
|
question={question}
|
|
onSubmit={onSubmit}
|
|
lastQuestion={lastQuestion}
|
|
brandColor={brandColor}
|
|
/>
|
|
) : question.type === QuestionType.NPS ? (
|
|
<NPSQuestion
|
|
question={question}
|
|
onSubmit={onSubmit}
|
|
lastQuestion={lastQuestion}
|
|
brandColor={brandColor}
|
|
/>
|
|
) : question.type === QuestionType.CTA ? (
|
|
<CTAQuestion
|
|
question={question}
|
|
onSubmit={onSubmit}
|
|
lastQuestion={lastQuestion}
|
|
brandColor={brandColor}
|
|
/>
|
|
) : question.type === QuestionType.Rating ? (
|
|
<RatingQuestion
|
|
question={question}
|
|
onSubmit={onSubmit}
|
|
lastQuestion={lastQuestion}
|
|
brandColor={brandColor}
|
|
/>
|
|
) : null;
|
|
}
|