@elice/material-quiz 1.240718.0-trasncript.2 → 1.240718.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/eb-sortable/EbDraggable.js +33 -42
- package/cjs/components/eb-sortable/EbDroppable.js +20 -27
- package/cjs/components/markdown-editor/index.d.ts +2 -1
- package/cjs/components/markdown-editor/index.js +10 -19
- package/cjs/components/material-quiz/MaterialQuiz.js +83 -114
- package/cjs/components/material-quiz/MaterialQuizAnswerExplanation.js +29 -36
- package/cjs/components/material-quiz/MaterialQuizInfo.js +149 -151
- package/cjs/components/material-quiz/MaterialQuizSelectMultiple.js +127 -175
- package/cjs/components/material-quiz/MaterialQuizSelectMultipleOrder.js +286 -360
- package/cjs/components/material-quiz/MaterialQuizSelectOne.js +126 -172
- package/cjs/components/material-quiz/MaterialQuizShimmer.js +39 -46
- package/cjs/components/material-quiz/MaterialQuizText.js +115 -163
- package/cjs/components/material-quiz/QuizResultBadge.js +22 -32
- package/cjs/components/material-quiz/QuizSubmitStatusText.js +16 -21
- package/cjs/components/material-quiz/constants/color.js +5 -5
- package/cjs/components/material-quiz/context/MaterialQuizContext.d.ts +1 -1
- package/cjs/components/material-quiz/context/MaterialQuizContext.js +93 -156
- package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroup.js +161 -259
- package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupDesktop.js +100 -134
- package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupMobile.js +101 -130
- package/cjs/components/material-quiz/material-quiz-group/MaterialQuizGroupOptionItem.js +52 -64
- package/cjs/components/material-quiz/material-quiz-group/context/context.js +1 -5
- package/cjs/components/material-quiz-edit/MaterialQuizEdit.js +36 -47
- package/cjs/components/material-quiz-edit/MaterialQuizEditContent.js +232 -280
- package/cjs/components/material-quiz-edit/context.js +2 -8
- package/cjs/components/material-quiz-edit/options/OptionEditor.js +46 -70
- package/cjs/components/material-quiz-edit/options/OptionSelectMultiple.js +148 -174
- package/cjs/components/material-quiz-edit/options/OptionSelectMultipleOrder.js +149 -175
- package/cjs/components/material-quiz-edit/options/OptionSelectOne.js +144 -164
- package/cjs/components/material-quiz-edit/options/OptionText.js +82 -90
- package/cjs/components/material-quiz-edit/options/options-group/OptionGroup.js +8 -9
- package/cjs/components/material-quiz-edit/options/options-group/OptionGroupAnswerInfo.js +112 -156
- package/cjs/components/material-quiz-edit/options/options-group/OptionGroupAnswerListItem.js +196 -288
- package/cjs/components/material-quiz-edit/options/options-group/OptionGroupGroupInfo.js +75 -88
- package/cjs/components/material-quiz-edit/options/options-group/OptionGroupGroupListItem.js +92 -108
- package/cjs/components/material-quiz-edit/utils/checkTwoDimensionArray.js +1 -5
- package/cjs/components/material-quiz-edit/utils/editValue.js +12 -21
- package/cjs/components/shared/QuestionBox.js +165 -198
- package/cjs/components/shared/QuizDraggbleDroppedOption.js +12 -11
- package/cjs/components/shared/QuizDraggbleDummyOption.js +16 -23
- package/cjs/components/shared/QuizDraggbleOption.js +59 -65
- package/cjs/components/shared/StyledMarkdown.js +1 -5
- package/cjs/components/shared/question-checkbox/QuestionCheckbox.js +7 -13
- package/cjs/components/shared/question-checkbox/QuestionCheckboxContext.d.ts +1 -1
- package/cjs/components/shared/question-checkbox/QuestionCheckboxContext.js +17 -24
- package/cjs/components/shared/question-checkbox/QuestionCheckboxOption.js +68 -59
- package/cjs/components/shared/question-radio/QuestionRadio.js +7 -13
- package/cjs/components/shared/question-radio/QuestionRadioContext.d.ts +1 -1
- package/cjs/components/shared/question-radio/QuestionRadioContext.js +17 -24
- package/cjs/components/shared/question-radio/QuestionRadioOption.js +59 -52
- package/cjs/components/shared/utils/getQuestionStatusStyle.js +9 -7
- package/cjs/components/shared/utils/mergeRefs.js +6 -15
- package/cjs/constant/element.js +3 -3
- package/cjs/helpers/index.js +10 -8
- package/cjs/hooks/useCaculatePassage.js +20 -21
- package/es/components/eb-sortable/EbDraggable.js +33 -37
- package/es/components/eb-sortable/EbDroppable.js +20 -22
- package/es/components/markdown-editor/index.d.ts +2 -1
- package/es/components/markdown-editor/index.js +10 -15
- package/es/components/material-quiz/MaterialQuiz.js +83 -109
- package/es/components/material-quiz/MaterialQuizAnswerExplanation.js +29 -32
- package/es/components/material-quiz/MaterialQuizInfo.js +150 -148
- package/es/components/material-quiz/MaterialQuizSelectMultiple.js +127 -171
- package/es/components/material-quiz/MaterialQuizSelectMultipleOrder.js +287 -356
- package/es/components/material-quiz/MaterialQuizSelectOne.js +126 -168
- package/es/components/material-quiz/MaterialQuizShimmer.js +39 -42
- package/es/components/material-quiz/MaterialQuizText.js +115 -158
- package/es/components/material-quiz/QuizResultBadge.js +22 -27
- package/es/components/material-quiz/QuizSubmitStatusText.js +16 -17
- package/es/components/material-quiz/constants/color.js +5 -5
- package/es/components/material-quiz/context/MaterialQuizContext.d.ts +1 -1
- package/es/components/material-quiz/context/MaterialQuizContext.js +94 -153
- package/es/components/material-quiz/material-quiz-group/MaterialQuizGroup.js +161 -253
- package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupDesktop.js +100 -129
- package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupMobile.js +101 -125
- package/es/components/material-quiz/material-quiz-group/MaterialQuizGroupOptionItem.js +52 -60
- package/es/components/material-quiz/material-quiz-group/context/context.js +1 -1
- package/es/components/material-quiz-edit/MaterialQuizEdit.js +36 -43
- package/es/components/material-quiz-edit/MaterialQuizEditContent.js +229 -272
- package/es/components/material-quiz-edit/context.js +2 -4
- package/es/components/material-quiz-edit/options/OptionEditor.js +46 -64
- package/es/components/material-quiz-edit/options/OptionSelectMultiple.js +148 -170
- package/es/components/material-quiz-edit/options/OptionSelectMultipleOrder.js +149 -171
- package/es/components/material-quiz-edit/options/OptionSelectOne.js +144 -159
- package/es/components/material-quiz-edit/options/OptionText.js +82 -86
- package/es/components/material-quiz-edit/options/options-group/OptionGroup.js +8 -9
- package/es/components/material-quiz-edit/options/options-group/OptionGroupAnswerInfo.js +112 -151
- package/es/components/material-quiz-edit/options/options-group/OptionGroupAnswerListItem.js +197 -283
- package/es/components/material-quiz-edit/options/options-group/OptionGroupGroupInfo.js +75 -83
- package/es/components/material-quiz-edit/options/options-group/OptionGroupGroupListItem.js +92 -103
- package/es/components/material-quiz-edit/utils/checkTwoDimensionArray.js +1 -5
- package/es/components/material-quiz-edit/utils/editValue.js +12 -17
- package/es/components/shared/QuestionBox.js +165 -192
- package/es/components/shared/QuizDraggbleDroppedOption.js +12 -11
- package/es/components/shared/QuizDraggbleDummyOption.js +16 -19
- package/es/components/shared/QuizDraggbleOption.js +59 -61
- package/es/components/shared/StyledMarkdown.js +1 -1
- package/es/components/shared/question-checkbox/QuestionCheckbox.js +7 -9
- package/es/components/shared/question-checkbox/QuestionCheckboxContext.d.ts +1 -1
- package/es/components/shared/question-checkbox/QuestionCheckboxContext.js +17 -20
- package/es/components/shared/question-checkbox/QuestionCheckboxOption.js +68 -54
- package/es/components/shared/question-radio/QuestionRadio.js +7 -9
- package/es/components/shared/question-radio/QuestionRadioContext.d.ts +1 -1
- package/es/components/shared/question-radio/QuestionRadioContext.js +17 -20
- package/es/components/shared/question-radio/QuestionRadioOption.js +59 -47
- package/es/components/shared/utils/getQuestionStatusStyle.js +9 -7
- package/es/components/shared/utils/mergeRefs.js +6 -15
- package/es/constant/element.js +3 -3
- package/es/helpers/index.js +10 -8
- package/es/hooks/useCaculatePassage.js +20 -21
- package/package.json +15 -12
- package/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -423
- package/cjs/components/material-quiz/index.js +0 -9
- package/cjs/components/material-quiz/locales/index.js +0 -13
- package/cjs/components/material-quiz-edit/index.js +0 -7
- package/cjs/components/material-quiz-edit/locales/index.js +0 -13
- package/cjs/components/shared/index.js +0 -19
- package/cjs/constant/index.js +0 -9
- package/cjs/hooks/index.js +0 -7
- package/es/_virtual/_rollupPluginBabelHelpers.js +0 -408
- package/es/components/material-quiz/index.js +0 -2
- package/es/components/material-quiz/locales/index.js +0 -4
- package/es/components/material-quiz-edit/index.js +0 -1
- package/es/components/material-quiz-edit/locales/index.js +0 -4
- package/es/components/shared/index.js +0 -7
- package/es/constant/index.js +0 -1
- package/es/hooks/index.js +0 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { Flex, Button, Vspace, Text, Icon } from '@elice/blocks';
|
|
4
3
|
import { base } from '@elice/design-tokens';
|
|
@@ -10,169 +9,141 @@ import { useMaterialQuizState } from '../context/MaterialQuizContext.js';
|
|
|
10
9
|
import QuizGroupContext from './context/context.js';
|
|
11
10
|
import MaterialQuizGroupOptionItem from './MaterialQuizGroupOptionItem.js';
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
const QUIZ_OPTIONS_CONTENT_WIDTH = 534;
|
|
13
|
+
const StyledQuizAnswerWrapper = styled.div.withConfig({
|
|
15
14
|
componentId: "sc-18trt81-0"
|
|
16
15
|
})(["display:flex;flex-direction:column;flex:0 0 calc((100% - ", "px) / 2);"], QUIZ_OPTIONS_CONTENT_WIDTH);
|
|
17
|
-
|
|
16
|
+
const StyledQuizAnswerDropzoneWrapper = styled.div.withConfig({
|
|
18
17
|
componentId: "sc-18trt81-1"
|
|
19
18
|
})(["padding:1rem;border-radius:0.5rem;background:", ";&:not(:last-child){margin-bottom:1rem;}"], base.color.white);
|
|
20
|
-
|
|
19
|
+
const StyledQuizAnswerDropzone = styled(EbDroppable).withConfig({
|
|
21
20
|
componentId: "sc-18trt81-2"
|
|
22
|
-
})(["display:flex;flex-wrap:wrap;gap:0.5rem;justify-content:", ";align-items:", ";min-width:12.5rem;min-height:16.25rem;padding:0.5rem;border-radius:0.5rem;background:", ";text-align:center;outline:1px dashed ", ";&.ui-droppable-hover{outline:1px dashed ", ";}"],
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}, base.color.gray1, base.color.gray3, base.color.navy4);
|
|
29
|
-
var StyledQuizOptions = styled.div.withConfig({
|
|
21
|
+
})(["display:flex;flex-wrap:wrap;gap:0.5rem;justify-content:", ";align-items:", ";min-width:12.5rem;min-height:16.25rem;padding:0.5rem;border-radius:0.5rem;background:", ";text-align:center;outline:1px dashed ", ";&.ui-droppable-hover{outline:1px dashed ", ";}"], ({
|
|
22
|
+
isGroupAnswer
|
|
23
|
+
}) => isGroupAnswer ? 'flex-start' : 'center', ({
|
|
24
|
+
isGroupAnswer
|
|
25
|
+
}) => isGroupAnswer ? 'flex-start' : 'center', base.color.gray1, base.color.gray3, base.color.navy4);
|
|
26
|
+
const StyledQuizOptions = styled.div.withConfig({
|
|
30
27
|
componentId: "sc-18trt81-3"
|
|
31
28
|
})(["display:flex;flex-direction:column;width:26.125rem;height:fit-content;padding:1rem;background-color:", ";border-radius:0.5rem;outline:1px dashed ", ";"], base.color.navy6, base.color.navy4);
|
|
32
|
-
|
|
29
|
+
const StyledQuizOptionsDropzone = styled(EbDroppable).withConfig({
|
|
33
30
|
componentId: "sc-18trt81-4"
|
|
34
31
|
})(["display:flex;flex-wrap:wrap;gap:1rem;min-height:10.25rem;border-radius:0.5rem;outline:1px dashed ", ";&.ui-droppable-hover{outline:1px dashed ", ";}"], base.color.navy4, base.color.gray4);
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
userId
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
32
|
+
const MaterialQuizGroupDesktop = () => {
|
|
33
|
+
const intl = useRawEliceIntl();
|
|
34
|
+
const {
|
|
35
|
+
userId
|
|
36
|
+
} = useMaterialQuizState();
|
|
37
|
+
const {
|
|
38
|
+
groupList,
|
|
39
|
+
currentAnswerList,
|
|
40
|
+
currentOptionList,
|
|
41
|
+
updateCurrentAnswer,
|
|
42
|
+
updateCurrentOption,
|
|
43
|
+
handleAnswerReset
|
|
44
|
+
} = React.useContext(QuizGroupContext);
|
|
46
45
|
/**
|
|
47
46
|
*
|
|
48
47
|
*/
|
|
49
|
-
|
|
50
|
-
return
|
|
48
|
+
const renderQuizContentSortation = () => {
|
|
49
|
+
return React.createElement(Flex, {
|
|
51
50
|
align: "center",
|
|
52
|
-
margin: "0 1.25rem"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
});
|
|
51
|
+
margin: "0 1.25rem"
|
|
52
|
+
}, React.createElement(Icon, {
|
|
53
|
+
size: "large",
|
|
54
|
+
icon: eilSortItem,
|
|
55
|
+
rotate: 90,
|
|
56
|
+
color: "white"
|
|
57
|
+
}));
|
|
60
58
|
};
|
|
61
59
|
/**
|
|
62
60
|
*
|
|
63
61
|
*/
|
|
64
|
-
|
|
62
|
+
const renderQuizGroupAnswer = (title, dropzoneIndex) => {
|
|
65
63
|
var _a, _b;
|
|
66
|
-
|
|
67
|
-
return
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
children: intl.formatMessage({
|
|
90
|
-
id: 'materialQuiz.dropzone.desktop.answerEmpty'
|
|
91
|
-
})
|
|
92
|
-
})
|
|
93
|
-
})]
|
|
94
|
-
});
|
|
64
|
+
const isGroupAnswer = Boolean((_a = currentAnswerList[dropzoneIndex]) === null || _a === void 0 ? void 0 : _a.length);
|
|
65
|
+
return React.createElement(StyledQuizAnswerDropzoneWrapper, null, React.createElement(Text, {
|
|
66
|
+
size: "large",
|
|
67
|
+
bold: true
|
|
68
|
+
}, title), React.createElement(Vspace, {
|
|
69
|
+
height: 1
|
|
70
|
+
}), React.createElement(StyledQuizAnswerDropzone, {
|
|
71
|
+
accept: ".quiz-answer",
|
|
72
|
+
disabled: !!userId,
|
|
73
|
+
isGroupAnswer: isGroupAnswer,
|
|
74
|
+
onDrop: (event, ui) => {
|
|
75
|
+
const targetId = Number(ui.draggable[0].id);
|
|
76
|
+
updateCurrentAnswer(targetId, dropzoneIndex);
|
|
77
|
+
}
|
|
78
|
+
}, isGroupAnswer ? (_b = currentAnswerList[dropzoneIndex]) === null || _b === void 0 ? void 0 : _b.map((answer, index) => React.createElement(MaterialQuizGroupOptionItem, {
|
|
79
|
+
key: index,
|
|
80
|
+
option: answer
|
|
81
|
+
})) : React.createElement(Text, {
|
|
82
|
+
role: "gray5",
|
|
83
|
+
bold: true
|
|
84
|
+
}, intl.formatMessage({
|
|
85
|
+
id: 'materialQuiz.dropzone.desktop.answerEmpty'
|
|
86
|
+
}))));
|
|
95
87
|
};
|
|
96
88
|
/**
|
|
97
89
|
*
|
|
98
90
|
*/
|
|
99
|
-
|
|
100
|
-
return
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}).map(function (group, index) {
|
|
104
|
-
return jsx(React.Fragment, {
|
|
105
|
-
children: renderQuizGroupAnswer(group, index * 2)
|
|
106
|
-
}, index);
|
|
107
|
-
})
|
|
108
|
-
});
|
|
91
|
+
const renderQuizContentLeft = () => {
|
|
92
|
+
return React.createElement(StyledQuizAnswerWrapper, null, groupList.filter((_, index) => !(index % 2)).map((group, index) => React.createElement(React.Fragment, {
|
|
93
|
+
key: index
|
|
94
|
+
}, renderQuizGroupAnswer(group, index * 2))));
|
|
109
95
|
};
|
|
110
96
|
/**
|
|
111
97
|
*
|
|
112
98
|
*/
|
|
113
|
-
|
|
114
|
-
return
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}).map(function (group, index) {
|
|
118
|
-
return jsx(React.Fragment, {
|
|
119
|
-
children: renderQuizGroupAnswer(group, index * 2 + 1)
|
|
120
|
-
}, index);
|
|
121
|
-
})
|
|
122
|
-
});
|
|
99
|
+
const renderQuizContentRight = () => {
|
|
100
|
+
return React.createElement(StyledQuizAnswerWrapper, null, groupList.filter((_, index) => index % 2).map((group, index) => React.createElement(React.Fragment, {
|
|
101
|
+
key: index
|
|
102
|
+
}, renderQuizGroupAnswer(group, index * 2 + 1))));
|
|
123
103
|
};
|
|
124
104
|
/**
|
|
125
105
|
*
|
|
126
106
|
*/
|
|
127
|
-
|
|
128
|
-
return
|
|
129
|
-
height: "fit-content"
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
children: intl.formatMessage({
|
|
160
|
-
id: 'materialQuiz.dropzone.optionEmpty'
|
|
161
|
-
})
|
|
162
|
-
})
|
|
163
|
-
})
|
|
164
|
-
})]
|
|
165
|
-
}), renderQuizContentSortation()]
|
|
166
|
-
});
|
|
107
|
+
const renderQuizContentOption = () => {
|
|
108
|
+
return React.createElement(Flex, {
|
|
109
|
+
height: "fit-content"
|
|
110
|
+
}, renderQuizContentSortation(), React.createElement(StyledQuizOptions, null, React.createElement(Button, {
|
|
111
|
+
role: "white",
|
|
112
|
+
size: "small",
|
|
113
|
+
disabled: !!userId,
|
|
114
|
+
onClick: handleAnswerReset
|
|
115
|
+
}, intl.formatMessage({
|
|
116
|
+
id: 'materialQuiz.dropzone.optionReset'
|
|
117
|
+
})), React.createElement(Vspace, {
|
|
118
|
+
height: 1
|
|
119
|
+
}), React.createElement(StyledQuizOptionsDropzone, {
|
|
120
|
+
accept: ".quiz-answer",
|
|
121
|
+
onDrop: (event, ui) => {
|
|
122
|
+
const targetId = Number(ui.draggable[0].id);
|
|
123
|
+
updateCurrentOption(targetId);
|
|
124
|
+
}
|
|
125
|
+
}, currentOptionList.length ? currentOptionList.map((option, index) => React.createElement(MaterialQuizGroupOptionItem, {
|
|
126
|
+
key: index,
|
|
127
|
+
option: option
|
|
128
|
+
})) : React.createElement(Flex, {
|
|
129
|
+
justify: "center",
|
|
130
|
+
align: "center",
|
|
131
|
+
width: "100%"
|
|
132
|
+
}, React.createElement(Text, {
|
|
133
|
+
role: "navy",
|
|
134
|
+
textAlign: "center",
|
|
135
|
+
bold: true
|
|
136
|
+
}, intl.formatMessage({
|
|
137
|
+
id: 'materialQuiz.dropzone.optionEmpty'
|
|
138
|
+
}))))), renderQuizContentSortation());
|
|
167
139
|
};
|
|
168
140
|
//
|
|
169
141
|
//
|
|
170
142
|
//
|
|
171
|
-
return
|
|
143
|
+
return React.createElement(Flex, {
|
|
172
144
|
width: "100%",
|
|
173
|
-
height: "100%"
|
|
174
|
-
|
|
175
|
-
});
|
|
145
|
+
height: "100%"
|
|
146
|
+
}, renderQuizContentLeft(), renderQuizContentOption(), renderQuizContentRight());
|
|
176
147
|
};
|
|
177
148
|
|
|
178
149
|
export { MaterialQuizGroupDesktop as default };
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { slicedToArray as _slicedToArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
1
|
import React from 'react';
|
|
4
2
|
import { Button, Vspace, Text, BottomSheet } from '@elice/blocks';
|
|
5
3
|
import { base } from '@elice/design-tokens';
|
|
@@ -9,158 +7,136 @@ import { useMaterialQuizState } from '../context/MaterialQuizContext.js';
|
|
|
9
7
|
import QuizGroupContext from './context/context.js';
|
|
10
8
|
import MaterialQuizGroupOptionItem from './MaterialQuizGroupOptionItem.js';
|
|
11
9
|
|
|
12
|
-
|
|
10
|
+
const StyledQuizGroupWrapper = styled.div.withConfig({
|
|
13
11
|
componentId: "sc-bftjpj-0"
|
|
14
12
|
})(["display:flex;flex-direction:column;overflow:hidden;width:100%;padding:1rem;background:", ";border-radius:0.5rem;&:hover{cursor:pointer;}&:not(:last-child){margin-bottom:1rem;}"], base.color.white);
|
|
15
|
-
|
|
13
|
+
const StyledQuizOptionList = styled.div.withConfig({
|
|
16
14
|
componentId: "sc-bftjpj-1"
|
|
17
|
-
})(["display:flex;align-items:", ";gap:0.5rem;overflow-x:auto;min-height:223px;padding:1rem;border-radius:0.5rem;background:", ";outline-color:", ";"],
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var StyledQuizOptionItem = styled.div.withConfig({
|
|
15
|
+
})(["display:flex;align-items:", ";gap:0.5rem;overflow-x:auto;min-height:223px;padding:1rem;border-radius:0.5rem;background:", ";outline-color:", ";"], ({
|
|
16
|
+
isCurrentOptionList
|
|
17
|
+
}) => isCurrentOptionList ? 'flex-start' : 'center', base.color.gray1, base.color.gray3);
|
|
18
|
+
const StyledQuizOptionItem = styled.div.withConfig({
|
|
22
19
|
componentId: "sc-bftjpj-2"
|
|
23
20
|
})(["&:hover{cursor:pointer;}"]);
|
|
24
|
-
|
|
21
|
+
const StyledBottomSheetWrapper = styled(StyledQuizOptionList).withConfig({
|
|
25
22
|
componentId: "sc-bftjpj-3"
|
|
26
|
-
})(["align-items:", ";padding:0.5rem;"],
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
var intl = useRawEliceIntl();
|
|
23
|
+
})(["align-items:", ";padding:0.5rem;"], ({
|
|
24
|
+
vertical,
|
|
25
|
+
isCurrentOptionList
|
|
26
|
+
}) => vertical && isCurrentOptionList ? 'flex-start' : 'center');
|
|
27
|
+
const MaterialQuizGroupMobile = () => {
|
|
28
|
+
const intl = useRawEliceIntl();
|
|
33
29
|
// context
|
|
34
|
-
|
|
35
|
-
materialQuiz
|
|
36
|
-
userId
|
|
37
|
-
vertical
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
setDropzoneIndex = _React$useState2[1];
|
|
30
|
+
const {
|
|
31
|
+
materialQuiz,
|
|
32
|
+
userId,
|
|
33
|
+
vertical
|
|
34
|
+
} = useMaterialQuizState();
|
|
35
|
+
const {
|
|
36
|
+
currentOptionList,
|
|
37
|
+
currentAnswerList,
|
|
38
|
+
updateCurrentAnswer,
|
|
39
|
+
updateCurrentOption,
|
|
40
|
+
handleAnswerReset
|
|
41
|
+
} = React.useContext(QuizGroupContext);
|
|
42
|
+
const [dropzoneIndex, setDropzoneIndex] = React.useState(null);
|
|
48
43
|
/**
|
|
49
44
|
*
|
|
50
45
|
*/
|
|
51
|
-
|
|
52
|
-
return
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
height: 1
|
|
64
|
-
})]
|
|
65
|
-
});
|
|
46
|
+
const renderResetButton = () => {
|
|
47
|
+
return React.createElement(React.Fragment, null, React.createElement(Button, {
|
|
48
|
+
role: "white",
|
|
49
|
+
size: "small",
|
|
50
|
+
disabled: !!userId,
|
|
51
|
+
onClick: handleAnswerReset,
|
|
52
|
+
block: true
|
|
53
|
+
}, intl.formatMessage({
|
|
54
|
+
id: 'materialQuiz.dropzone.optionReset'
|
|
55
|
+
})), React.createElement(Vspace, {
|
|
56
|
+
height: 1
|
|
57
|
+
}));
|
|
66
58
|
};
|
|
67
59
|
/**
|
|
68
60
|
*
|
|
69
61
|
*/
|
|
70
|
-
|
|
62
|
+
const renderGroupList = () => {
|
|
71
63
|
var _a;
|
|
72
|
-
return
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
children: intl.formatMessage({
|
|
103
|
-
id: 'materialQuiz.dropzone.mobile.answerEmpty'
|
|
104
|
-
})
|
|
105
|
-
})
|
|
106
|
-
})]
|
|
107
|
-
}, index);
|
|
108
|
-
})
|
|
109
|
-
});
|
|
64
|
+
return React.createElement(React.Fragment, null, (_a = materialQuiz === null || materialQuiz === void 0 ? void 0 : materialQuiz.groups) === null || _a === void 0 ? void 0 : _a.map((group, index) => {
|
|
65
|
+
var _a;
|
|
66
|
+
const isCurrentOptionList = Boolean((_a = currentAnswerList === null || currentAnswerList === void 0 ? void 0 : currentAnswerList[index]) === null || _a === void 0 ? void 0 : _a.length);
|
|
67
|
+
return React.createElement(StyledQuizGroupWrapper, {
|
|
68
|
+
key: index,
|
|
69
|
+
onClick: () => setDropzoneIndex(index)
|
|
70
|
+
}, React.createElement(Text, {
|
|
71
|
+
size: "small",
|
|
72
|
+
bold: true
|
|
73
|
+
}, group), React.createElement(Vspace, {
|
|
74
|
+
height: 0.5
|
|
75
|
+
}), React.createElement(StyledQuizOptionList, {
|
|
76
|
+
isCurrentOptionList: isCurrentOptionList
|
|
77
|
+
}, isCurrentOptionList ? currentAnswerList[index].map(answer => React.createElement(MaterialQuizGroupOptionItem, {
|
|
78
|
+
key: answer.order,
|
|
79
|
+
option: answer,
|
|
80
|
+
onClose: () => {
|
|
81
|
+
const targetId = answer.order;
|
|
82
|
+
updateCurrentOption(targetId);
|
|
83
|
+
}
|
|
84
|
+
})) : React.createElement(Text, {
|
|
85
|
+
role: "gray6",
|
|
86
|
+
size: "small",
|
|
87
|
+
textAlign: "center",
|
|
88
|
+
bold: true,
|
|
89
|
+
block: true
|
|
90
|
+
}, intl.formatMessage({
|
|
91
|
+
id: 'materialQuiz.dropzone.mobile.answerEmpty'
|
|
92
|
+
}))));
|
|
93
|
+
}));
|
|
110
94
|
};
|
|
111
95
|
/**
|
|
112
96
|
*
|
|
113
97
|
*/
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
return
|
|
98
|
+
const renderOptionListBottomSheet = () => {
|
|
99
|
+
const isCurrentOptionList = Boolean(currentOptionList.length);
|
|
100
|
+
return React.createElement(BottomSheet, {
|
|
117
101
|
show: dropzoneIndex !== null,
|
|
118
102
|
title: intl.formatMessage({
|
|
119
103
|
id: 'materialQuiz.bottomSheet.title'
|
|
120
104
|
}),
|
|
121
105
|
contentsText: "",
|
|
122
106
|
disableSwipeGesture: true,
|
|
123
|
-
onClose:
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
children: intl.formatMessage({
|
|
152
|
-
id: 'materialQuiz.bottomSheet.optionEmpty'
|
|
153
|
-
})
|
|
154
|
-
})
|
|
155
|
-
})
|
|
156
|
-
});
|
|
107
|
+
onClose: () => setDropzoneIndex(null)
|
|
108
|
+
}, React.createElement(StyledBottomSheetWrapper, {
|
|
109
|
+
vertical: vertical,
|
|
110
|
+
isCurrentOptionList: isCurrentOptionList
|
|
111
|
+
}, isCurrentOptionList ? currentOptionList === null || currentOptionList === void 0 ? void 0 : currentOptionList.map((option, index) => React.createElement(StyledQuizOptionItem, {
|
|
112
|
+
key: index,
|
|
113
|
+
onClick: () => {
|
|
114
|
+
const targetId = option.order;
|
|
115
|
+
if (dropzoneIndex === null) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
if (!!userId) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
updateCurrentAnswer(targetId, dropzoneIndex);
|
|
122
|
+
}
|
|
123
|
+
}, React.createElement(MaterialQuizGroupOptionItem, {
|
|
124
|
+
key: index,
|
|
125
|
+
option: option
|
|
126
|
+
}))) : React.createElement(Text, {
|
|
127
|
+
role: "gray6",
|
|
128
|
+
size: "small",
|
|
129
|
+
textAlign: "center",
|
|
130
|
+
bold: true,
|
|
131
|
+
block: true
|
|
132
|
+
}, intl.formatMessage({
|
|
133
|
+
id: 'materialQuiz.bottomSheet.optionEmpty'
|
|
134
|
+
}))));
|
|
157
135
|
};
|
|
158
136
|
//
|
|
159
137
|
//
|
|
160
138
|
//
|
|
161
|
-
return
|
|
162
|
-
children: [renderResetButton(), renderGroupList(), renderOptionListBottomSheet()]
|
|
163
|
-
});
|
|
139
|
+
return React.createElement(React.Fragment, null, renderResetButton(), renderGroupList(), renderOptionListBottomSheet());
|
|
164
140
|
};
|
|
165
141
|
|
|
166
142
|
export { MaterialQuizGroupMobile as default };
|