UNPKG

@instructure/quiz-interactions

Version:

A React UI component Library for quiz interaction types.

80 lines (78 loc) 2.88 kB
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'; /** --- category: MultipleChoice --- Multiple Choice Show component ```jsx_example <SettingsSwitcher locales={LOCALES}> <MultipleChoiceShow itemId="mc_type" itemBody="Who was the first President of the United States?" interactionData={{ choices: [ { id: 'uuid1', itemBody: 'George Washington', position: 1 }, { id: 'uuid2', itemBody: 'Alexander Hamilton.', position: 2 }, { id: 'uuid3', itemBody: 'John Adams', position: 3 }, { id: 'uuid4', itemBody: 'Thomas Jefferson', position: 4 } ] }} scoringData={{ value: 'uuid1' }} /> </SettingsSwitcher> ``` **/ var MultipleChoiceShow = /*#__PURE__*/function (_Component) { function MultipleChoiceShow() { _classCallCheck(this, MultipleChoiceShow); return _callSuper(this, MultipleChoiceShow, arguments); } _inherits(MultipleChoiceShow, _Component); return _createClass(MultipleChoiceShow, [{ key: "render", value: function render() { return /*#__PURE__*/React.createElement(Take, { interactionData: this.props.interactionData, itemBody: this.props.itemBody, itemId: this.props.itemId, userResponse: { value: this.props.scoringData.value }, readOnly: true }); } }]); }(Component); _defineProperty(MultipleChoiceShow, "propTypes", { itemBody: PropTypes.string.isRequired, itemId: PropTypes.string.isRequired, interactionData: Take.propTypes.interactionData, scoringData: Take.propTypes.userResponse }); _defineProperty(MultipleChoiceShow, "defaultProps", { interactionData: void 0, scoringData: void 0 }); export { MultipleChoiceShow as default };