Skip to content

Commit

Permalink
feat: Apply에 Description 추가 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
lurgi committed Jan 28, 2025
1 parent 7cbd706 commit 0235a47
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ interface ApplyProps {
applyState: Question[];
addQuestion: () => void;
setQuestionTitle: (index: number) => (title: string) => void;
setQuestionDescription: (index: number) => (description: string) => void;
setQuestionType: (index: number) => (type: Question['type']) => void;
setQuestionOptions: (index: number) => (Options: QuestionOptionValue[]) => void;
setQuestionRequiredToggle: (index: number) => () => void;
Expand All @@ -25,6 +26,7 @@ export default function Apply({
applyState,
addQuestion,
setQuestionTitle,
setQuestionDescription,
setQuestionType,
setQuestionOptions,
setQuestionRequiredToggle,
Expand Down Expand Up @@ -68,6 +70,7 @@ export default function Apply({
index={index}
question={question}
setQuestionTitle={setQuestionTitle}
setQuestionDescription={setQuestionDescription}
setQuestionType={setQuestionType}
setQuestionOptions={setQuestionOptions}
setQuestionPrev={setQuestionPrev}
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/hooks/useDashboardCreateForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ interface UseDashboardCreateFormReturn {

addQuestion: () => void;
setQuestionTitle: (index: number) => (title: string) => void;
setQuestionDescription: (index: number) => (description: string) => void;
setQuestionType: (index: number) => (type: Question['type']) => void;
setQuestionOptions: (index: number) => (Options: QuestionOptionValue[]) => void;
setQuestionRequiredToggle: (index: number) => () => void;
Expand Down Expand Up @@ -133,6 +134,14 @@ export default function useDashboardCreateForm(): UseDashboardCreateFormReturn {
});
};

const setQuestionDescription = (index: number) => (string: string) => {
setApplyState((prevState) => {
const questionsCopy = [...prevState];
questionsCopy[index].description = string;
return questionsCopy;
});
};

const setQuestionType = (index: number) => (type: Question['type']) => {
setApplyState((prevState) => {
const questionsCopy = [...prevState];
Expand Down Expand Up @@ -207,6 +216,7 @@ export default function useDashboardCreateForm(): UseDashboardCreateFormReturn {

addQuestion,
setQuestionTitle,
setQuestionDescription,
setQuestionType,
setQuestionOptions,
setQuestionRequiredToggle,
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/pages/DashboardCreate/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default function DashboardCreate() {

addQuestion,
setQuestionTitle,
setQuestionDescription,
setQuestionType,
setQuestionOptions,
setQuestionRequiredToggle,
Expand Down Expand Up @@ -57,6 +58,7 @@ export default function DashboardCreate() {
addQuestion={addQuestion}
setQuestionTitle={setQuestionTitle}
setQuestionType={setQuestionType}
setQuestionDescription={setQuestionDescription}
setQuestionOptions={setQuestionOptions}
setQuestionRequiredToggle={setQuestionRequiredToggle}
setQuestionPrev={setQuestionPrev}
Expand Down

0 comments on commit 0235a47

Please sign in to comment.