@micromag/screen-quiz 0.3.619 → 0.3.624

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/es/index.js +47 -4
  2. package/package.json +2 -2
package/es/index.js CHANGED
@@ -269,8 +269,9 @@ var Answers = function Answers(_ref) {
269
269
  var hasAnswer = isTextFilled(label);
270
270
  var isUserAnswer = withoutGoodAnswer && userAnswer;
271
271
  var isOtherAnswer = withoutGoodAnswer && !userAnswer;
272
- var inactiveButtonStyle = isOtherAnswer ? inactiveButtonsStyle : null;
273
- var inactiveButtonTextStyle = isOtherAnswer ? inactiveButtonsTextStyle : null;
272
+ var isInactive = isOtherAnswer && answeredIndex !== null;
273
+ var inactiveButtonStyle = isInactive ? inactiveButtonsStyle : null;
274
+ var inactiveButtonTextStyle = isInactive ? inactiveButtonsTextStyle : null;
274
275
  return /*#__PURE__*/React.createElement(animated.div, {
275
276
  key: "answer-".concat(answerI),
276
277
  className: classNames([styles$4.item, _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, styles$4.rightAnswer, !withoutGoodAnswer && rightAnswer === true), styles$4.userAnswer, isUserAnswer), styles$4.otherAnswer, isOtherAnswer), styles$4.withoutOpacity, !hasOpacity)]),
@@ -349,6 +350,7 @@ var propTypes$4 = {
349
350
  buttonsTextStyle: PropTypes.textStyle,
350
351
  inactiveButtonsTextStyle: PropTypes.textStyle,
351
352
  questionsHeadingStyle: PropTypes.textStyle,
353
+ feedbackTextStyle: PropTypes.textStyle,
352
354
  goodAnswerColor: PropTypes.color,
353
355
  badAnswerColor: PropTypes.color,
354
356
  focusable: PropTypes$1.bool,
@@ -381,6 +383,7 @@ var defaultProps$4 = {
381
383
  buttonsTextStyle: null,
382
384
  inactiveButtonsTextStyle: null,
383
385
  questionsHeadingStyle: null,
386
+ feedbackTextStyle: null,
384
387
  goodAnswerColor: null,
385
388
  badAnswerColor: null,
386
389
  focusable: false,
@@ -413,6 +416,7 @@ var Question = function Question(_ref) {
413
416
  buttonsTextStyle = _ref.buttonsTextStyle,
414
417
  inactiveButtonsTextStyle = _ref.inactiveButtonsTextStyle,
415
418
  questionsHeadingStyle = _ref.questionsHeadingStyle,
419
+ feedbackTextStyle = _ref.feedbackTextStyle,
416
420
  goodAnswerColor = _ref.goodAnswerColor,
417
421
  badAnswerColor = _ref.badAnswerColor,
418
422
  focusable = _ref.focusable,
@@ -454,6 +458,10 @@ var Question = function Question(_ref) {
454
458
  var hasResultVisual = isImageFilled(answerImage) || isImageFilled(resultImage);
455
459
  var defaultResult = isTextFilled(result) ? result : null;
456
460
  var customResult = isTextFilled(customAnswerLabel) ? customAnswerLabel : null;
461
+ var finalResult = customResult || defaultResult;
462
+ var _ref4 = finalResult || {},
463
+ _ref4$textStyle = _ref4.textStyle,
464
+ resultTextStyle = _ref4$textStyle === undefined ? null : _ref4$textStyle;
457
465
  var onAnswersCollapse = useCallback(function () {
458
466
  setResultVisible(true);
459
467
  }, [setResultVisible]);
@@ -536,8 +544,9 @@ var Question = function Question(_ref) {
536
544
  playing: transitionPlaying,
537
545
  delay: (1 + answers.length) * transitionStagger,
538
546
  disabled: transitionDisabled
539
- }, hasResult ? /*#__PURE__*/React.createElement(Text, Object.assign({}, customResult || defaultResult, {
540
- className: styles$3.resultText
547
+ }, hasResult ? /*#__PURE__*/React.createElement(Text, Object.assign({}, finalResult || {}, {
548
+ className: styles$3.resultText,
549
+ textStyle: _objectSpread(_objectSpread({}, feedbackTextStyle || null), resultTextStyle || null)
541
550
  })) : null, hasResultVisual ? /*#__PURE__*/React.createElement(Visual, {
542
551
  media: answerImage || resultImage,
543
552
  width: "100%",
@@ -563,6 +572,7 @@ var propTypes$3 = {
563
572
  inactiveButtonsStyle: PropTypes.boxStyle,
564
573
  buttonsTextStyle: PropTypes.textStyle,
565
574
  inactiveButtonsTextStyle: PropTypes.textStyle,
575
+ feedbackTextStyle: PropTypes.textStyle,
566
576
  goodAnswerColor: PropTypes.color,
567
577
  badAnswerColor: PropTypes.color,
568
578
  withoutTrueFalse: PropTypes$1.bool,
@@ -589,6 +599,7 @@ var defaultProps$3 = {
589
599
  inactiveButtonsStyle: null,
590
600
  buttonsTextStyle: null,
591
601
  inactiveButtonsTextStyle: null,
602
+ feedbackTextStyle: null,
592
603
  goodAnswerColor: null,
593
604
  badAnswerColor: null,
594
605
  withoutTrueFalse: false,
@@ -615,6 +626,7 @@ var QuizScreen = function QuizScreen(_ref) {
615
626
  inactiveButtonsStyle = _ref.inactiveButtonsStyle,
616
627
  buttonsTextStyle = _ref.buttonsTextStyle,
617
628
  inactiveButtonsTextStyle = _ref.inactiveButtonsTextStyle,
629
+ feedbackTextStyle = _ref.feedbackTextStyle,
618
630
  goodAnswerColor = _ref.goodAnswerColor,
619
631
  badAnswerColor = _ref.badAnswerColor,
620
632
  withoutTrueFalse = _ref.withoutTrueFalse,
@@ -796,6 +808,7 @@ var QuizScreen = function QuizScreen(_ref) {
796
808
  buttonsTextStyle: buttonsTextStyle,
797
809
  inactiveButtonsStyle: inactiveButtonsStyle,
798
810
  inactiveButtonsTextStyle: inactiveButtonsTextStyle,
811
+ feedbackTextStyle: feedbackTextStyle,
799
812
  goodAnswerColor: goodAnswerColor,
800
813
  badAnswerColor: badAnswerColor,
801
814
  withoutTrueFalse: withoutTrueFalse,
@@ -1673,6 +1686,16 @@ var definition = [{
1673
1686
  "value": "Inactive buttons"
1674
1687
  }]
1675
1688
  })
1689
+ }, {
1690
+ name: 'feedbackTextStyle',
1691
+ type: 'text-style-form',
1692
+ label: defineMessage({
1693
+ id: "4w7K2K",
1694
+ defaultMessage: [{
1695
+ "type": 0,
1696
+ "value": "Feedback text"
1697
+ }]
1698
+ })
1676
1699
  }, {
1677
1700
  name: 'goodAnswerColor',
1678
1701
  type: 'color',
@@ -2003,6 +2026,26 @@ var definition = [{
2003
2026
  "value": "Buttons text"
2004
2027
  }]
2005
2028
  })
2029
+ }, {
2030
+ name: 'inactiveButtonsTextStyle',
2031
+ type: 'text-style-form',
2032
+ label: defineMessage({
2033
+ id: "my7Kox",
2034
+ defaultMessage: [{
2035
+ "type": 0,
2036
+ "value": "Inactive buttons text"
2037
+ }]
2038
+ })
2039
+ }, {
2040
+ name: 'inactiveButtonsStyle',
2041
+ type: 'box-style-form',
2042
+ label: defineMessage({
2043
+ id: "xlFOg3",
2044
+ defaultMessage: [{
2045
+ "type": 0,
2046
+ "value": "Inactive buttons"
2047
+ }]
2048
+ })
2006
2049
  }, {
2007
2050
  name: 'questionsHeadingStyle',
2008
2051
  type: 'text-style-form',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@micromag/screen-quiz",
3
- "version": "0.3.619",
3
+ "version": "0.3.624",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "keywords": [
@@ -89,5 +89,5 @@
89
89
  "access": "public",
90
90
  "registry": "https://registry.npmjs.org/"
91
91
  },
92
- "gitHead": "21a901b0f800114994f30dfe692c664d378e12f7"
92
+ "gitHead": "dae93d8ee83abe0aa8f51a31a94e32f7b5ad9104"
93
93
  }