-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FE] refactor: 서술형 필수 질문에 최소/최대 문구 안내 추가 #566
Changes from 4 commits
6ca10e8
d242806
ea2997a
792b3e2
b658e5e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './modal'; | ||
export * from './textarea'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export const TEXT_ANSWER_LENGTH = { | ||
min: 20, | ||
max: 1000, | ||
extra: 10, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import { TEXT_ANSWER_LENGTH } from '@/pages/ReviewWritingPage/constants'; | ||
import { MultipleChoiceAnswer, TextAnswer } from '@/pages/ReviewWritingPage/form/components'; | ||
import { ReviewWritingCardQuestion } from '@/types'; | ||
|
||
|
@@ -15,12 +16,21 @@ const QnABox = ({ question }: QnABoxProps) => { | |
* 객관식 문항의 최소,최대 개수에 대한 안내 문구 | ||
*/ | ||
const multipleLGuideline = (() => { | ||
const { optionGroup } = question; | ||
if (!optionGroup) return; | ||
const { optionGroup, questionType } = question; | ||
|
||
// NOTE: 객관식일 경우의 안내 문구 처리 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NOTE 다음은 주관식에 대한 내용이기 때문에 해당 주석 삭제하거나 객관식에 대한 안내문구 코드쪽으로 옮겨주세요. |
||
if (questionType === 'TEXT') { | ||
const guideline = question.required | ||
? `(최소 ${TEXT_ANSWER_LENGTH.min}자 ~ 최대 ${TEXT_ANSWER_LENGTH.max}자)` | ||
: `(최대 ${TEXT_ANSWER_LENGTH.max}자)`; | ||
return guideline; | ||
} | ||
|
||
if (!optionGroup) return; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. optionGroup은 주관식은 null이고, 객관식은 null값이 아니에요. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
const { minCount, maxCount } = optionGroup; | ||
|
||
const isAllSelectAvailable = maxCount === optionGroup.options.length; | ||
|
||
if (!maxCount || isAllSelectAvailable) return `(최소 ${minCount}개 이상)`; | ||
|
||
return `(${minCount}개 ~ ${maxCount}개)`; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
안내문구가 기존에는 객관식에 대해서만 있었는데, 주관식이 생겨서 함수로 분리해도 좋겠네요