UNPKG

@instructure/quiz-interactions

Version:

A React UI component Library for quiz interaction types.

77 lines (75 loc) 2.78 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 Match from '../common/Match'; /** --- category: Matching --- Matching Take component ```jsx_example <SettingsSwitcher locales={LOCALES}> <TakeStateProvider> <MatchingTake 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'] }} userResponse={{ value: { quuid1: 'George Washington' } }} /> </TakeStateProvider> </SettingsSwitcher> ``` **/ var MatchingTake = /*#__PURE__*/function (_Component) { function MatchingTake() { _classCallCheck(this, MatchingTake); return _callSuper(this, MatchingTake, arguments); } _inherits(MatchingTake, _Component); return _createClass(MatchingTake, [{ key: "render", value: function render() { return /*#__PURE__*/React.createElement(Match, Object.assign({}, this.props, { selectedAnswers: this.props.userResponse })); } }]); }(Component); _defineProperty(MatchingTake, "propTypes", { handleResponseUpdate: PropTypes.func.isRequired, interactionData: Match.propTypes.interactionData, itemBody: PropTypes.string.isRequired, userResponse: Match.propTypes.selectedAnswers }); _defineProperty(MatchingTake, "defaultProps", { interactionData: void 0, userResponse: void 0 }); export { MatchingTake as default };