Files
classroomio/packages/ui/src/custom/exercise-question/renderers/true-false/preview.svelte
T

19 lines
771 B
Svelte
Raw Normal View History

2026-03-09 11:18:22 +01:00
<script lang="ts">
import { getExerciseQuestionLabel, type ExerciseQuestionRendererProps } from '@cio/question-types';
import { getTrueFalseCorrectIsTrue } from './true-false-correct';
2026-03-09 11:18:22 +01:00
let { question, labels }: ExerciseQuestionRendererProps = $props();
const label = (key: Parameters<typeof getExerciseQuestionLabel>[1], fallback = '') =>
getExerciseQuestionLabel(labels, key, fallback);
const correctValue = $derived(
getTrueFalseCorrectIsTrue(question.settings as Record<string, unknown> | undefined)
? label('true_false.true_label')
: label('true_false.false_label')
2026-03-09 11:18:22 +01:00
);
</script>
<div class="ui:space-y-1">
<p class="ui:text-muted-foreground ui:text-sm">{label('true_false.preview.correct_value_label')}: {correctValue}</p>
</div>