UNPKG

@instructure/quiz-interactions

Version:

A React UI component Library for quiz interaction types.

35 lines (28 loc) 840 B
import React from 'react' import {Text} from '@instructure/ui-text' import InteractionType from '../InteractionType' import {TRUE_FALSE_SLUG} from '../../interaction_slugs' import t from '@instructure/quiz-i18n/format-message' export default class TrueFalseInteractionType extends InteractionType { constructor(obj) { super() super.initializeProps(obj) } slug = TRUE_FALSE_SLUG translatedName = t('True or False') getDefaultScoringData = () => ({value: true}) getDefaultInteractionData = () => ({ trueChoice: t('True'), falseChoice: t('False'), }) getRenderedResponse = (responseValue, interactionData) => { return ( <Text color="primary"> {responseValue ? interactionData.trueChoice : interactionData.falseChoice} </Text> ) } static validations() { return {} } }