@instructure/quiz-interactions
Version:
A React UI component Library for quiz interaction types.
86 lines (84 loc) • 2.87 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 Match from '../common/Match';
var noop = function noop() {};
/**
---
category: Matching
---
Matching Show component
```jsx_example
<SettingsSwitcher locales={LOCALES}>
<MatchingShow
itemBody="Match the Presidential term with the corresponding President."
interactionData={{
questions: [
{ id: 'quuid1', itemBody: '1st President' },
{ id: 'quuid2', itemBody: '16th President' },
{ id: 'quuid3', itemBody: '44th President' }
],
answers: [
'George Washington',
'Thomas Jefferson',
'Abraham Lincoln',
'Barack Obama'
]
}}
scoringData={{
value: {
quuid1: 'George Washington',
quuid2: 'Abraham Lincoln',
quuid3: 'Barack Obama'
}
}}
/>
</SettingsSwitcher>
```
**/
var MatchingShow = /*#__PURE__*/function (_Component) {
function MatchingShow() {
_classCallCheck(this, MatchingShow);
return _callSuper(this, MatchingShow, arguments);
}
_inherits(MatchingShow, _Component);
return _createClass(MatchingShow, [{
key: "render",
value: function render() {
return /*#__PURE__*/React.createElement(Match, Object.assign({}, this.props, {
selectedAnswers: this.props.scoringData,
handleResponseUpdate: noop,
readOnly: true
}));
}
}]);
}(Component);
_defineProperty(MatchingShow, "propTypes", {
itemBody: PropTypes.string.isRequired,
interactionData: Match.propTypes.interactionData,
scoringData: Match.propTypes.selectedAnswers
});
_defineProperty(MatchingShow, "defaultProps", {
interactionData: void 0,
scoringData: void 0
});
export { MatchingShow as default };