@instructure/quiz-interactions
Version:
A React UI component Library for quiz interaction types.
85 lines (83 loc) • 3.08 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 _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
import _inherits from "@babel/runtime/helpers/esm/inherits";
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, { Component } from 'react';
import PropTypes from 'prop-types';
import Take from '../Take';
var noop = function noop() {};
/**
---
category: MultipleAnswer
---
Multiple Answer Show component
```jsx_example
<SettingsSwitcher locales={LOCALES}>
<MultipleAnswerShow
itemBody="Who was in the first cabinet of the USA?"
interactionData={{
choices: [
{ id: 'uuid1', itemBody: 'Thomas Jefferson', position: 1 },
{ id: 'uuid2', itemBody: 'John Marshall', position: 2 },
{ id: 'uuid3', itemBody: 'John Knox', position: 3 },
{ id: 'uuid4', itemBody: 'Alexander Hamilton', position: 4 },
{ id: 'uuid5', itemBody: 'Aaron Burr', position: 5 },
{ id: 'uuid6', itemBody: 'Ben Franklin', position: 6 }
]
}}
scoringData={{ value: ['uuid1', 'uuid3', 'uuid4'] }}
/>
</SettingsSwitcher>
```
**/
var MultipleAnswerShow = /*#__PURE__*/function (_Component) {
function MultipleAnswerShow() {
_classCallCheck(this, MultipleAnswerShow);
return _callSuper(this, MultipleAnswerShow, arguments);
}
_inherits(MultipleAnswerShow, _Component);
return _createClass(MultipleAnswerShow, [{
key: "render",
value: function render() {
return /*#__PURE__*/React.createElement(Take, {
interactionData: this.props.interactionData,
itemBody: this.props.itemBody,
itemId: this.props.itemId,
handleResponseUpdate: noop,
userResponse: {
value: this.props.scoringData.value
},
readOnly: true
});
}
}]);
}(Component);
_defineProperty(MultipleAnswerShow, "propTypes", {
itemBody: PropTypes.string,
itemId: PropTypes.string,
interactionData: Take.propTypes.interactionData,
scoringData: Take.propTypes.userResponse
});
_defineProperty(MultipleAnswerShow, "defaultProps", {
itemBody: void 0,
itemId: void 0,
interactionData: void 0,
scoringData: void 0
});
export { MultipleAnswerShow as default };