Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
students
survey
Commits
81684249
Commit
81684249
authored
Jul 23, 2022
by
Yoon, Daeki
😅
Browse files
질문 타입 상수로 공유
parent
4d2e3d2b
Changes
3
Show whitespace changes
Inline
Side-by-side
frontend/src/commons/constants.ts
0 → 100644
View file @
81684249
export
const
QUESTION_TYPES
=
new
Map
([
[
"
essay
"
,
"
주관식
"
],
[
"
radio
"
,
"
객관식
"
],
[
"
dropdown
"
,
"
드롭다운
"
],
[
"
checkbox
"
,
"
체크박스
"
],
[
"
file
"
,
"
파일
"
],
[
"
rating
"
,
"
선형
"
],
[
"
grid
"
,
"
그리드
"
],
[
"
date
"
,
"
날짜
"
],
]);
frontend/src/commons/index.tsx
View file @
81684249
export
{
Header
}
from
"
./Header
"
;
export
{
QUESTION_TYPES
}
from
"
./constants
"
;
frontend/src/questions/Question.tsx
View file @
81684249
import
React
,
{
useState
,
Dispatch
,
SetStateAction
}
from
"
react
"
;
import
{
BasicQuestionType
,
EssayType
}
from
"
../types
"
;
import
React
,
{
useState
}
from
"
react
"
;
import
{
BasicQuestionType
}
from
"
../types
"
;
import
{
questionApi
}
from
"
../apis
"
;
import
{
EssayForm
}
from
"
./EssayForm
"
;
import
{
CheckboxForm
}
from
"
./CheckboxForm
"
;
...
...
@@ -8,6 +8,7 @@ import { DropdownForm } from "./DropdownForm";
import
{
FileForm
}
from
"
./FileForm
"
;
import
{
RatingForm
}
from
"
./RatingForm
"
;
import
{
DateForm
}
from
"
./DateForm
"
;
import
{
QUESTION_TYPES
}
from
"
../commons
"
;
type
Props
=
{
element
:
BasicQuestionType
;
...
...
@@ -15,17 +16,6 @@ type Props = {
deleteQuestion
:
(
id
:
string
)
=>
void
;
};
const
typeDropDown
=
new
Map
([
[
"
essay
"
,
"
주관식
"
],
[
"
radio
"
,
"
객관식
"
],
[
"
dropdown
"
,
"
드롭다운
"
],
[
"
checkbox
"
,
"
체크박스
"
],
[
"
file
"
,
"
파일
"
],
[
"
rating
"
,
"
선형
"
],
[
"
grid
"
,
"
그리드
"
],
[
"
date
"
,
"
날짜
"
],
]);
export
const
Question
=
({
element
,
handleQuestion
,
...
...
@@ -165,7 +155,7 @@ export const Question = ({
disabled
=
{
save
}
className
=
"w-36 bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-themeColor w-full mr-3 p-2.5"
>
{
Array
.
from
(
typeDropDown
.
entries
()).
map
(([
key
,
value
])
=>
(
{
Array
.
from
(
QUESTION_TYPES
.
entries
()).
map
(([
key
,
value
])
=>
(
<
option
key
=
{
key
}
id
=
{
element
.
_id
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment