UNPKG

quiz-interactions

Version:

A React UI component Library for quiz interaction types.

98 lines (80 loc) 2.83 kB
"use strict"; var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")); var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")); var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); var _react = _interopRequireWildcard(require("react")); var _propTypes = _interopRequireDefault(require("prop-types")); var _Match = _interopRequireDefault(require("../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) { (0, _inherits2.default)(MatchingShow, _Component); function MatchingShow() { (0, _classCallCheck2.default)(this, MatchingShow); return (0, _possibleConstructorReturn2.default)(this, (0, _getPrototypeOf2.default)(MatchingShow).apply(this, arguments)); } (0, _createClass2.default)(MatchingShow, [{ key: "render", value: function render() { return _react.default.createElement(_Match.default, Object.assign({}, this.props, { selectedAnswers: this.props.scoringData, handleResponseUpdate: noop, readOnly: true })); } }]); MatchingShow.displayName = "MatchingShow"; return MatchingShow; }(_react.Component); exports.default = MatchingShow; MatchingShow.propTypes = { itemBody: _propTypes.default.string.isRequired, interactionData: _Match.default.propTypes.interactionData, scoringData: _Match.default.propTypes.selectedAnswers }; MatchingShow.defaultProps = { interactionData: void 0, scoringData: void 0 };