@instructure/quiz-interactions
Version:
A React UI component Library for quiz interaction types.
61 lines • 2.69 kB
JavaScript
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _get from "@babel/runtime/helpers/esm/get";
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
function _callSuper(_this, derived, args) {
function isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
return !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
} catch (e) {
return false;
}
}
derived = _getPrototypeOf(derived);
return _possibleConstructorReturn(_this, isNativeReflectConstruct() ? Reflect.construct(derived, args || [], _getPrototypeOf(_this).constructor) : derived.apply(_this, args));
}
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/es/format-message';
var TrueFalseInteractionType = /*#__PURE__*/function (_InteractionType) {
function TrueFalseInteractionType(obj) {
var _this2;
_classCallCheck(this, TrueFalseInteractionType);
_this2 = _callSuper(this, TrueFalseInteractionType);
_defineProperty(_this2, "slug", TRUE_FALSE_SLUG);
_defineProperty(_this2, "translatedName", t('True or False'));
_defineProperty(_this2, "getDefaultScoringData", function () {
return {
value: true
};
});
_defineProperty(_this2, "getDefaultInteractionData", function () {
return {
trueChoice: t('True'),
falseChoice: t('False')
};
});
_defineProperty(_this2, "getRenderedResponse", function (responseValue, interactionData) {
return /*#__PURE__*/React.createElement(Text, {
color: "primary"
}, responseValue ? interactionData.trueChoice : interactionData.falseChoice);
});
_get((_this2, _getPrototypeOf(TrueFalseInteractionType.prototype)), "initializeProps", _this2).call(_this2, obj);
return _this2;
}
_inherits(TrueFalseInteractionType, _InteractionType);
return _createClass(TrueFalseInteractionType, null, [{
key: "validations",
value: function validations() {
return {};
}
}]);
}(InteractionType);
export { TrueFalseInteractionType as default };