@elice/material-quiz 1.230629.1 → 1.230705.1
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.
- package/cjs/components/material-quiz/MaterialQuiz.js +20 -23
- package/cjs/components/material-quiz/MaterialQuizSelectMultiple.js +3 -3
- package/cjs/components/material-quiz/MaterialQuizSelectOne.js +3 -3
- package/cjs/components/shared/question-checkbox/QuestionCheckboxOption.js +7 -28
- package/cjs/components/shared/question-radio/QuestionRadioOption.js +8 -29
- package/cjs/components/shared/utils/getQuestionStatusStyle.d.ts +10 -0
- package/cjs/components/shared/utils/getQuestionStatusStyle.js +26 -0
- package/es/components/material-quiz/MaterialQuiz.js +20 -23
- package/es/components/material-quiz/MaterialQuizSelectMultiple.js +3 -3
- package/es/components/material-quiz/MaterialQuizSelectOne.js +3 -3
- package/es/components/shared/question-checkbox/QuestionCheckboxOption.js +7 -28
- package/es/components/shared/question-radio/QuestionRadioOption.js +8 -29
- package/es/components/shared/utils/getQuestionStatusStyle.d.ts +10 -0
- package/es/components/shared/utils/getQuestionStatusStyle.js +22 -0
- package/package.json +4 -4
|
@@ -64,7 +64,8 @@ var StyledMaterialQuizWrapper = styled__default["default"].div.withConfig({
|
|
|
64
64
|
var MaterialQuiz = function MaterialQuiz() {
|
|
65
65
|
var _useMaterialQuizState = MaterialQuizContext.useMaterialQuizState(),
|
|
66
66
|
materialQuiz = _useMaterialQuizState.materialQuiz,
|
|
67
|
-
vertical = _useMaterialQuizState.vertical
|
|
67
|
+
vertical = _useMaterialQuizState.vertical,
|
|
68
|
+
course = _useMaterialQuizState.course;
|
|
68
69
|
var _useMaterialQuizDispa = MaterialQuizContext.useMaterialQuizDispatch(),
|
|
69
70
|
setVertical = _useMaterialQuizDispa.setVertical;
|
|
70
71
|
var _useMeasure = reactUse.useMeasure(),
|
|
@@ -77,33 +78,29 @@ var MaterialQuiz = function MaterialQuiz() {
|
|
|
77
78
|
setVertical(width <= designTokens.base.screen.medium);
|
|
78
79
|
}
|
|
79
80
|
}, [width, setVertical]);
|
|
80
|
-
var
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
default:
|
|
98
|
-
Component = React__default["default"].createElement(MaterialQuizShimmer["default"], null);
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
81
|
+
var renderQuestionOption = function renderQuestionOption() {
|
|
82
|
+
if (!materialQuiz || !course) {
|
|
83
|
+
return React__default["default"].createElement(MaterialQuizShimmer["default"], null);
|
|
84
|
+
}
|
|
85
|
+
switch (materialQuiz.optionType) {
|
|
86
|
+
case types.enums.QuizOptionType.SelectOne:
|
|
87
|
+
return React__default["default"].createElement(AsyncMaterialQuizSelectOne, null);
|
|
88
|
+
case types.enums.QuizOptionType.SelectMultiple:
|
|
89
|
+
return React__default["default"].createElement(AsyncMaterialQuizSelectMultiple, null);
|
|
90
|
+
case types.enums.QuizOptionType.Text:
|
|
91
|
+
return React__default["default"].createElement(AsyncMaterialQuizText, null);
|
|
92
|
+
case types.enums.QuizOptionType.SelectMultipleOrder:
|
|
93
|
+
return React__default["default"].createElement(AsyncMaterialQuizSelectMultipleOrder, null);
|
|
94
|
+
case types.enums.QuizOptionType.Group:
|
|
95
|
+
return React__default["default"].createElement(AsyncMaterialQuizGroup, null);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
101
98
|
return React__default["default"].createElement(React__default["default"].Suspense, {
|
|
102
99
|
fallback: null
|
|
103
100
|
}, React__default["default"].createElement(StyledMaterialQuizWrapper, {
|
|
104
101
|
ref: ref,
|
|
105
102
|
vertical: vertical
|
|
106
|
-
}, isQuizGroupType ? null : React__default["default"].createElement(StyledMaterialQuizInfo, null, React__default["default"].createElement(MaterialQuizInfo["default"], null)), React__default["default"].createElement(StyledMaterialQuizContent, null,
|
|
103
|
+
}, isQuizGroupType ? null : React__default["default"].createElement(StyledMaterialQuizInfo, null, React__default["default"].createElement(MaterialQuizInfo["default"], null)), React__default["default"].createElement(StyledMaterialQuizContent, null, renderQuestionOption())));
|
|
107
104
|
};
|
|
108
105
|
var MaterialQuizContainer = function MaterialQuizContainer(_ref7) {
|
|
109
106
|
var materialQuizId = _ref7.materialQuizId,
|
|
@@ -211,7 +211,7 @@ var MaterialQuizSelectMultiple = function MaterialQuizSelectMultiple() {
|
|
|
211
211
|
onSelect: handleAnswerSelect,
|
|
212
212
|
selectedOptions: selectedAnswer,
|
|
213
213
|
disabled: submitStatus === 'pending' || index.checkUserLectureTestEnded(lecture) || !!userId
|
|
214
|
-
}, (materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.options) ? materialQuiz.options.map(function (option, index$1) {
|
|
214
|
+
}, (materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.options) && course ? materialQuiz.options.map(function (option, index$1) {
|
|
215
215
|
var _a;
|
|
216
216
|
var getIsSelected = function getIsSelected(index, materialQuizResponse) {
|
|
217
217
|
var _a;
|
|
@@ -232,11 +232,11 @@ var MaterialQuizSelectMultiple = function MaterialQuizSelectMultiple() {
|
|
|
232
232
|
value: index$1,
|
|
233
233
|
status: status,
|
|
234
234
|
isAnswer: !!userId && Array.isArray(materialQuizAnswerInfo) && materialQuizAnswerInfo.includes(index$1)
|
|
235
|
-
},
|
|
235
|
+
}, course.preference.renderMarkdownInQuizOptions ? React__default["default"].createElement(StyledMarkdown["default"], {
|
|
236
236
|
children: (_a = option === null || option === void 0 ? void 0 : option.content) !== null && _a !== void 0 ? _a : '',
|
|
237
237
|
paddingx: 0,
|
|
238
238
|
paddingy: 0,
|
|
239
|
-
dark:
|
|
239
|
+
dark: true
|
|
240
240
|
}) : option === null || option === void 0 ? void 0 : option.content);
|
|
241
241
|
}) : null));
|
|
242
242
|
};
|
|
@@ -200,7 +200,7 @@ var MaterialQuizSelectOne = function MaterialQuizSelectOne() {
|
|
|
200
200
|
selectedValue: selectedAnswer,
|
|
201
201
|
onSelect: handleAnswerSelect,
|
|
202
202
|
disabled: submitStatus === 'pending' || index.checkUserLectureTestEnded(lecture) || !!userId
|
|
203
|
-
}, materialQuiz.options ? materialQuiz.options.map(function (option, index$1) {
|
|
203
|
+
}, materialQuiz.options && course ? materialQuiz.options.map(function (option, index$1) {
|
|
204
204
|
var _a, _b;
|
|
205
205
|
var getIsSelected = function getIsSelected(index, materialQuizResponse) {
|
|
206
206
|
var _a;
|
|
@@ -221,11 +221,11 @@ var MaterialQuizSelectOne = function MaterialQuizSelectOne() {
|
|
|
221
221
|
value: index$1,
|
|
222
222
|
status: status,
|
|
223
223
|
isAnswer: (_a = !!userId && Array.isArray(materialQuizAnswerInfo) && materialQuizAnswerInfo.includes(index$1)) !== null && _a !== void 0 ? _a : false
|
|
224
|
-
},
|
|
224
|
+
}, course.preference.renderMarkdownInQuizOptions ? React__default["default"].createElement(StyledMarkdown["default"], {
|
|
225
225
|
children: (_b = option === null || option === void 0 ? void 0 : option.content) !== null && _b !== void 0 ? _b : '',
|
|
226
226
|
paddingx: 0,
|
|
227
227
|
paddingy: 0,
|
|
228
|
-
dark:
|
|
228
|
+
dark: true
|
|
229
229
|
}) : option === null || option === void 0 ? void 0 : option.content);
|
|
230
230
|
}) : null) : null);
|
|
231
231
|
};
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var designTokens = require('@elice/design-tokens');
|
|
7
7
|
var styled = require('styled-components');
|
|
8
|
+
var getQuestionStatusStyle = require('../utils/getQuestionStatusStyle.js');
|
|
8
9
|
var QuestionCheckboxContext = require('./QuestionCheckboxContext.js');
|
|
9
10
|
|
|
10
11
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -90,34 +91,12 @@ var StyledQuestionCheckboxInput = styled__default["default"].input.withConfig({
|
|
|
90
91
|
});
|
|
91
92
|
var StyledLabel = styled__default["default"].label.withConfig({
|
|
92
93
|
componentId: "sc-1erloup-3"
|
|
93
|
-
})(["word-break:break-all;margin-right:0.875rem;font-size:", ";line-height:24px;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
case 'wrong':
|
|
100
|
-
return designTokens.base.color.red9;
|
|
101
|
-
default:
|
|
102
|
-
return checked ? designTokens.base.color.primary6 : designTokens.base.color.navy0;
|
|
103
|
-
}
|
|
104
|
-
}, function (_ref8) {
|
|
105
|
-
var checked = _ref8.checked,
|
|
106
|
-
status = _ref8.status;
|
|
107
|
-
switch (status) {
|
|
108
|
-
case 'correct':
|
|
109
|
-
return designTokens.base.color.green9;
|
|
110
|
-
case 'wrong':
|
|
111
|
-
return designTokens.base.color.red9;
|
|
112
|
-
default:
|
|
113
|
-
return checked ? designTokens.base.color.primary6 : designTokens.base.color.navy0;
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
var QuestionCheckboxOption = React__default["default"].memo(function (_ref9) {
|
|
117
|
-
var value = _ref9.value,
|
|
118
|
-
status = _ref9.status,
|
|
119
|
-
isAnswer = _ref9.isAnswer,
|
|
120
|
-
children = _ref9.children;
|
|
94
|
+
})(["word-break:break-all;margin-right:0.875rem;font-size:", ";line-height:24px;", ""], designTokens.base.size.body3, getQuestionStatusStyle.getQuestionStatusStyle());
|
|
95
|
+
var QuestionCheckboxOption = React__default["default"].memo(function (_ref7) {
|
|
96
|
+
var value = _ref7.value,
|
|
97
|
+
status = _ref7.status,
|
|
98
|
+
isAnswer = _ref7.isAnswer,
|
|
99
|
+
children = _ref7.children;
|
|
121
100
|
var _useQuestionCheckboxC = QuestionCheckboxContext.useQuestionCheckboxContext(),
|
|
122
101
|
selectedOptions = _useQuestionCheckboxC.selectedOptions,
|
|
123
102
|
disabled = _useQuestionCheckboxC.disabled,
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var designTokens = require('@elice/design-tokens');
|
|
7
7
|
var styled = require('styled-components');
|
|
8
|
+
var getQuestionStatusStyle = require('../utils/getQuestionStatusStyle.js');
|
|
8
9
|
var QuestionRadioContext = require('./QuestionRadioContext.js');
|
|
9
10
|
|
|
10
11
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -14,7 +15,7 @@ var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
|
14
15
|
|
|
15
16
|
var StyledQuestionRadioOption = styled__default["default"].div.withConfig({
|
|
16
17
|
componentId: "sc-cy66me-0"
|
|
17
|
-
})(["display:flex;align-items:center;padding:0.875rem 1rem;border-radius:8px;background-color:", ";&:not(:last-of-type){margin-bottom:1rem;}&:hover,& *:hover{cursor:", ";}", ""], function (_ref) {
|
|
18
|
+
})(["display:flex;align-items:center;padding:0.875rem 1rem;border-radius:8px;background-color:", ";overflow-x:auto;&:not(:last-of-type){margin-bottom:1rem;}&:hover,& *:hover{cursor:", ";}", ""], function (_ref) {
|
|
18
19
|
var checked = _ref.checked,
|
|
19
20
|
status = _ref.status;
|
|
20
21
|
switch (status) {
|
|
@@ -66,34 +67,12 @@ var StyledQuestionRadioInput = styled__default["default"].input.withConfig({
|
|
|
66
67
|
});
|
|
67
68
|
var StyledLabel = styled__default["default"].label.withConfig({
|
|
68
69
|
componentId: "sc-cy66me-2"
|
|
69
|
-
})(["word-break:break-all;margin-right:0.875rem;font-size:", ";line-height:24px;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
case 'wrong':
|
|
76
|
-
return designTokens.base.color.red9;
|
|
77
|
-
default:
|
|
78
|
-
return checked ? designTokens.base.color.primary6 : designTokens.base.color.navy0;
|
|
79
|
-
}
|
|
80
|
-
}, function (_ref7) {
|
|
81
|
-
var checked = _ref7.checked,
|
|
82
|
-
status = _ref7.status;
|
|
83
|
-
switch (status) {
|
|
84
|
-
case 'correct':
|
|
85
|
-
return designTokens.base.color.green9;
|
|
86
|
-
case 'wrong':
|
|
87
|
-
return designTokens.base.color.red9;
|
|
88
|
-
default:
|
|
89
|
-
return checked ? designTokens.base.color.primary6 : designTokens.base.color.navy0;
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
var QuestionRadioOption = React__default["default"].memo(function (_ref8) {
|
|
93
|
-
var value = _ref8.value,
|
|
94
|
-
status = _ref8.status,
|
|
95
|
-
isAnswer = _ref8.isAnswer,
|
|
96
|
-
children = _ref8.children;
|
|
70
|
+
})(["word-break:break-all;margin-right:0.875rem;font-size:", ";line-height:24px;", ""], designTokens.base.size.body3, getQuestionStatusStyle.getQuestionStatusStyle());
|
|
71
|
+
var QuestionRadioOption = React__default["default"].memo(function (_ref6) {
|
|
72
|
+
var value = _ref6.value,
|
|
73
|
+
status = _ref6.status,
|
|
74
|
+
isAnswer = _ref6.isAnswer,
|
|
75
|
+
children = _ref6.children;
|
|
97
76
|
var _useQuestionRadioCont = QuestionRadioContext.useQuestionRadioContext(),
|
|
98
77
|
selectedValue = _useQuestionRadioCont.selectedValue,
|
|
99
78
|
disabled = _useQuestionRadioCont.disabled,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare type Status = 'correct' | 'wrong' | 'answer';
|
|
2
|
+
interface QuestionValues {
|
|
3
|
+
checked: boolean;
|
|
4
|
+
status?: Status;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Get shared question custom style depend on checked, status values.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getQuestionStatusStyle(): import("styled-components").FlattenInterpolation<import("styled-components").ThemedStyledProps<QuestionValues, any>>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var designTokens = require('@elice/design-tokens');
|
|
6
|
+
var styled = require('styled-components');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Get shared question custom style depend on checked, status values.
|
|
10
|
+
*/
|
|
11
|
+
function getQuestionStatusStyle() {
|
|
12
|
+
return styled.css(["&,& p,& p.elicemd.elicemd--theme-dark{color:", ";}"], function (_ref) {
|
|
13
|
+
var checked = _ref.checked,
|
|
14
|
+
status = _ref.status;
|
|
15
|
+
switch (status) {
|
|
16
|
+
case 'correct':
|
|
17
|
+
return designTokens.base.color.green9;
|
|
18
|
+
case 'wrong':
|
|
19
|
+
return designTokens.base.color.red9;
|
|
20
|
+
default:
|
|
21
|
+
return checked ? designTokens.base.color.primary6 : designTokens.base.color.navy0;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
exports.getQuestionStatusStyle = getQuestionStatusStyle;
|
|
@@ -56,7 +56,8 @@ var StyledMaterialQuizWrapper = styled.div.withConfig({
|
|
|
56
56
|
var MaterialQuiz = function MaterialQuiz() {
|
|
57
57
|
var _useMaterialQuizState = useMaterialQuizState(),
|
|
58
58
|
materialQuiz = _useMaterialQuizState.materialQuiz,
|
|
59
|
-
vertical = _useMaterialQuizState.vertical
|
|
59
|
+
vertical = _useMaterialQuizState.vertical,
|
|
60
|
+
course = _useMaterialQuizState.course;
|
|
60
61
|
var _useMaterialQuizDispa = useMaterialQuizDispatch(),
|
|
61
62
|
setVertical = _useMaterialQuizDispa.setVertical;
|
|
62
63
|
var _useMeasure = useMeasure(),
|
|
@@ -69,33 +70,29 @@ var MaterialQuiz = function MaterialQuiz() {
|
|
|
69
70
|
setVertical(width <= base.screen.medium);
|
|
70
71
|
}
|
|
71
72
|
}, [width, setVertical]);
|
|
72
|
-
var
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
default:
|
|
90
|
-
Component = React.createElement(MaterialQuizShimmer, null);
|
|
91
|
-
break;
|
|
92
|
-
}
|
|
73
|
+
var renderQuestionOption = function renderQuestionOption() {
|
|
74
|
+
if (!materialQuiz || !course) {
|
|
75
|
+
return React.createElement(MaterialQuizShimmer, null);
|
|
76
|
+
}
|
|
77
|
+
switch (materialQuiz.optionType) {
|
|
78
|
+
case enums.QuizOptionType.SelectOne:
|
|
79
|
+
return React.createElement(AsyncMaterialQuizSelectOne, null);
|
|
80
|
+
case enums.QuizOptionType.SelectMultiple:
|
|
81
|
+
return React.createElement(AsyncMaterialQuizSelectMultiple, null);
|
|
82
|
+
case enums.QuizOptionType.Text:
|
|
83
|
+
return React.createElement(AsyncMaterialQuizText, null);
|
|
84
|
+
case enums.QuizOptionType.SelectMultipleOrder:
|
|
85
|
+
return React.createElement(AsyncMaterialQuizSelectMultipleOrder, null);
|
|
86
|
+
case enums.QuizOptionType.Group:
|
|
87
|
+
return React.createElement(AsyncMaterialQuizGroup, null);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
93
90
|
return React.createElement(React.Suspense, {
|
|
94
91
|
fallback: null
|
|
95
92
|
}, React.createElement(StyledMaterialQuizWrapper, {
|
|
96
93
|
ref: ref,
|
|
97
94
|
vertical: vertical
|
|
98
|
-
}, isQuizGroupType ? null : React.createElement(StyledMaterialQuizInfo, null, React.createElement(MaterialQuizInfo, null)), React.createElement(StyledMaterialQuizContent, null,
|
|
95
|
+
}, isQuizGroupType ? null : React.createElement(StyledMaterialQuizInfo, null, React.createElement(MaterialQuizInfo, null)), React.createElement(StyledMaterialQuizContent, null, renderQuestionOption())));
|
|
99
96
|
};
|
|
100
97
|
var MaterialQuizContainer = function MaterialQuizContainer(_ref7) {
|
|
101
98
|
var materialQuizId = _ref7.materialQuizId,
|
|
@@ -203,7 +203,7 @@ var MaterialQuizSelectMultiple = function MaterialQuizSelectMultiple() {
|
|
|
203
203
|
onSelect: handleAnswerSelect,
|
|
204
204
|
selectedOptions: selectedAnswer,
|
|
205
205
|
disabled: submitStatus === 'pending' || checkUserLectureTestEnded(lecture) || !!userId
|
|
206
|
-
}, (materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.options) ? materialQuiz.options.map(function (option, index) {
|
|
206
|
+
}, (materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.options) && course ? materialQuiz.options.map(function (option, index) {
|
|
207
207
|
var _a;
|
|
208
208
|
var getIsSelected = function getIsSelected(index, materialQuizResponse) {
|
|
209
209
|
var _a;
|
|
@@ -224,11 +224,11 @@ var MaterialQuizSelectMultiple = function MaterialQuizSelectMultiple() {
|
|
|
224
224
|
value: index,
|
|
225
225
|
status: status,
|
|
226
226
|
isAnswer: !!userId && Array.isArray(materialQuizAnswerInfo) && materialQuizAnswerInfo.includes(index)
|
|
227
|
-
},
|
|
227
|
+
}, course.preference.renderMarkdownInQuizOptions ? React.createElement(StyledMarkdown, {
|
|
228
228
|
children: (_a = option === null || option === void 0 ? void 0 : option.content) !== null && _a !== void 0 ? _a : '',
|
|
229
229
|
paddingx: 0,
|
|
230
230
|
paddingy: 0,
|
|
231
|
-
dark:
|
|
231
|
+
dark: true
|
|
232
232
|
}) : option === null || option === void 0 ? void 0 : option.content);
|
|
233
233
|
}) : null));
|
|
234
234
|
};
|
|
@@ -192,7 +192,7 @@ var MaterialQuizSelectOne = function MaterialQuizSelectOne() {
|
|
|
192
192
|
selectedValue: selectedAnswer,
|
|
193
193
|
onSelect: handleAnswerSelect,
|
|
194
194
|
disabled: submitStatus === 'pending' || checkUserLectureTestEnded(lecture) || !!userId
|
|
195
|
-
}, materialQuiz.options ? materialQuiz.options.map(function (option, index) {
|
|
195
|
+
}, materialQuiz.options && course ? materialQuiz.options.map(function (option, index) {
|
|
196
196
|
var _a, _b;
|
|
197
197
|
var getIsSelected = function getIsSelected(index, materialQuizResponse) {
|
|
198
198
|
var _a;
|
|
@@ -213,11 +213,11 @@ var MaterialQuizSelectOne = function MaterialQuizSelectOne() {
|
|
|
213
213
|
value: index,
|
|
214
214
|
status: status,
|
|
215
215
|
isAnswer: (_a = !!userId && Array.isArray(materialQuizAnswerInfo) && materialQuizAnswerInfo.includes(index)) !== null && _a !== void 0 ? _a : false
|
|
216
|
-
},
|
|
216
|
+
}, course.preference.renderMarkdownInQuizOptions ? React.createElement(StyledMarkdown, {
|
|
217
217
|
children: (_b = option === null || option === void 0 ? void 0 : option.content) !== null && _b !== void 0 ? _b : '',
|
|
218
218
|
paddingx: 0,
|
|
219
219
|
paddingy: 0,
|
|
220
|
-
dark:
|
|
220
|
+
dark: true
|
|
221
221
|
}) : option === null || option === void 0 ? void 0 : option.content);
|
|
222
222
|
}) : null) : null);
|
|
223
223
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { base } from '@elice/design-tokens';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
|
+
import { getQuestionStatusStyle } from '../utils/getQuestionStatusStyle.js';
|
|
4
5
|
import { useQuestionCheckboxContext } from './QuestionCheckboxContext.js';
|
|
5
6
|
|
|
6
7
|
var StyledQuestionCheckboxOption = styled.div.withConfig({
|
|
@@ -81,34 +82,12 @@ var StyledQuestionCheckboxInput = styled.input.withConfig({
|
|
|
81
82
|
});
|
|
82
83
|
var StyledLabel = styled.label.withConfig({
|
|
83
84
|
componentId: "sc-1erloup-3"
|
|
84
|
-
})(["word-break:break-all;margin-right:0.875rem;font-size:", ";line-height:24px;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
case 'wrong':
|
|
91
|
-
return base.color.red9;
|
|
92
|
-
default:
|
|
93
|
-
return checked ? base.color.primary6 : base.color.navy0;
|
|
94
|
-
}
|
|
95
|
-
}, function (_ref8) {
|
|
96
|
-
var checked = _ref8.checked,
|
|
97
|
-
status = _ref8.status;
|
|
98
|
-
switch (status) {
|
|
99
|
-
case 'correct':
|
|
100
|
-
return base.color.green9;
|
|
101
|
-
case 'wrong':
|
|
102
|
-
return base.color.red9;
|
|
103
|
-
default:
|
|
104
|
-
return checked ? base.color.primary6 : base.color.navy0;
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
var QuestionCheckboxOption = React.memo(function (_ref9) {
|
|
108
|
-
var value = _ref9.value,
|
|
109
|
-
status = _ref9.status,
|
|
110
|
-
isAnswer = _ref9.isAnswer,
|
|
111
|
-
children = _ref9.children;
|
|
85
|
+
})(["word-break:break-all;margin-right:0.875rem;font-size:", ";line-height:24px;", ""], base.size.body3, getQuestionStatusStyle());
|
|
86
|
+
var QuestionCheckboxOption = React.memo(function (_ref7) {
|
|
87
|
+
var value = _ref7.value,
|
|
88
|
+
status = _ref7.status,
|
|
89
|
+
isAnswer = _ref7.isAnswer,
|
|
90
|
+
children = _ref7.children;
|
|
112
91
|
var _useQuestionCheckboxC = useQuestionCheckboxContext(),
|
|
113
92
|
selectedOptions = _useQuestionCheckboxC.selectedOptions,
|
|
114
93
|
disabled = _useQuestionCheckboxC.disabled,
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { base } from '@elice/design-tokens';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
|
+
import { getQuestionStatusStyle } from '../utils/getQuestionStatusStyle.js';
|
|
4
5
|
import { useQuestionRadioContext } from './QuestionRadioContext.js';
|
|
5
6
|
|
|
6
7
|
var StyledQuestionRadioOption = styled.div.withConfig({
|
|
7
8
|
componentId: "sc-cy66me-0"
|
|
8
|
-
})(["display:flex;align-items:center;padding:0.875rem 1rem;border-radius:8px;background-color:", ";&:not(:last-of-type){margin-bottom:1rem;}&:hover,& *:hover{cursor:", ";}", ""], function (_ref) {
|
|
9
|
+
})(["display:flex;align-items:center;padding:0.875rem 1rem;border-radius:8px;background-color:", ";overflow-x:auto;&:not(:last-of-type){margin-bottom:1rem;}&:hover,& *:hover{cursor:", ";}", ""], function (_ref) {
|
|
9
10
|
var checked = _ref.checked,
|
|
10
11
|
status = _ref.status;
|
|
11
12
|
switch (status) {
|
|
@@ -57,34 +58,12 @@ var StyledQuestionRadioInput = styled.input.withConfig({
|
|
|
57
58
|
});
|
|
58
59
|
var StyledLabel = styled.label.withConfig({
|
|
59
60
|
componentId: "sc-cy66me-2"
|
|
60
|
-
})(["word-break:break-all;margin-right:0.875rem;font-size:", ";line-height:24px;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
case 'wrong':
|
|
67
|
-
return base.color.red9;
|
|
68
|
-
default:
|
|
69
|
-
return checked ? base.color.primary6 : base.color.navy0;
|
|
70
|
-
}
|
|
71
|
-
}, function (_ref7) {
|
|
72
|
-
var checked = _ref7.checked,
|
|
73
|
-
status = _ref7.status;
|
|
74
|
-
switch (status) {
|
|
75
|
-
case 'correct':
|
|
76
|
-
return base.color.green9;
|
|
77
|
-
case 'wrong':
|
|
78
|
-
return base.color.red9;
|
|
79
|
-
default:
|
|
80
|
-
return checked ? base.color.primary6 : base.color.navy0;
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
var QuestionRadioOption = React.memo(function (_ref8) {
|
|
84
|
-
var value = _ref8.value,
|
|
85
|
-
status = _ref8.status,
|
|
86
|
-
isAnswer = _ref8.isAnswer,
|
|
87
|
-
children = _ref8.children;
|
|
61
|
+
})(["word-break:break-all;margin-right:0.875rem;font-size:", ";line-height:24px;", ""], base.size.body3, getQuestionStatusStyle());
|
|
62
|
+
var QuestionRadioOption = React.memo(function (_ref6) {
|
|
63
|
+
var value = _ref6.value,
|
|
64
|
+
status = _ref6.status,
|
|
65
|
+
isAnswer = _ref6.isAnswer,
|
|
66
|
+
children = _ref6.children;
|
|
88
67
|
var _useQuestionRadioCont = useQuestionRadioContext(),
|
|
89
68
|
selectedValue = _useQuestionRadioCont.selectedValue,
|
|
90
69
|
disabled = _useQuestionRadioCont.disabled,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare type Status = 'correct' | 'wrong' | 'answer';
|
|
2
|
+
interface QuestionValues {
|
|
3
|
+
checked: boolean;
|
|
4
|
+
status?: Status;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Get shared question custom style depend on checked, status values.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getQuestionStatusStyle(): import("styled-components").FlattenInterpolation<import("styled-components").ThemedStyledProps<QuestionValues, any>>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { base } from '@elice/design-tokens';
|
|
2
|
+
import { css } from 'styled-components';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Get shared question custom style depend on checked, status values.
|
|
6
|
+
*/
|
|
7
|
+
function getQuestionStatusStyle() {
|
|
8
|
+
return css(["&,& p,& p.elicemd.elicemd--theme-dark{color:", ";}"], function (_ref) {
|
|
9
|
+
var checked = _ref.checked,
|
|
10
|
+
status = _ref.status;
|
|
11
|
+
switch (status) {
|
|
12
|
+
case 'correct':
|
|
13
|
+
return base.color.green9;
|
|
14
|
+
case 'wrong':
|
|
15
|
+
return base.color.red9;
|
|
16
|
+
default:
|
|
17
|
+
return checked ? base.color.primary6 : base.color.navy0;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { getQuestionStatusStyle };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elice/material-quiz",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.230705.1",
|
|
4
4
|
"description": "User view and editing components of Elice material quiz",
|
|
5
5
|
"repository": "https://git.elicer.io/elice/frontend/library/elice-material",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"@elice/icons": "^1.220803.0",
|
|
59
59
|
"@elice/icons-legacy": "npm:@elice/icons@0.220803.1",
|
|
60
60
|
"@elice/markdown": "^1.220803.0",
|
|
61
|
-
"@elice/material-shared-types": "1.
|
|
62
|
-
"@elice/material-shared-utils": "1.
|
|
61
|
+
"@elice/material-shared-types": "1.230705.1",
|
|
62
|
+
"@elice/material-shared-utils": "1.230705.1",
|
|
63
63
|
"@elice/types": "^1.230629.0",
|
|
64
64
|
"@types/classnames": "^2.3.1",
|
|
65
65
|
"@types/jquery": "^3.5.13",
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"react-use": "^17.2.4",
|
|
74
74
|
"styled-components": "^5.3.0"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "4660ca8beabc64bd82b64187ab5e684a1d5eeb11"
|
|
77
77
|
}
|