rentgen/components/report-window/questions.tsx

21 lines
547 B
TypeScript
Raw Normal View History

import * as Survey from 'survey-react';
2022-07-07 19:59:16 +02:00
import { RequestCluster } from '../../request-cluster';
import RawAnswers from './raw-answers';
import useSurvey from './use-survey';
export default function Questions({
2022-07-07 19:59:16 +02:00
clusters,
onComplete,
}: {
2022-07-07 19:59:16 +02:00
clusters: RequestCluster[];
onComplete: (data: RawAnswers) => void;
}) {
2022-07-07 19:59:16 +02:00
const survey = useSurvey(clusters, {
onComplete: (sender) => onComplete(sender.data),
});
if (!survey) {
2022-04-25 20:02:20 +02:00
return <div>Wczytywanie...</div>;
}
return <Survey.Survey model={survey} />;
}