diff --git a/apps/frontend/app/(client)/(main)/(create)/problem/create/_components/ProblemCreateContainer.tsx b/apps/frontend/app/(client)/(main)/(create)/problem/create/_components/ProblemCreateContainer.tsx index 48bc5936ad..c0e765fbe8 100644 --- a/apps/frontend/app/(client)/(main)/(create)/problem/create/_components/ProblemCreateContainer.tsx +++ b/apps/frontend/app/(client)/(main)/(create)/problem/create/_components/ProblemCreateContainer.tsx @@ -99,7 +99,8 @@ export function ProblemCreateContainer() { const [tab, setTab] = useState('Statement') return ( -
+ // TODO: statement 머지하기 전에 bg 속성 삭제 +

PROBLEM CREATE

@@ -107,14 +108,17 @@ export function ProblemCreateContainer() {

{problemProgress.toUpperCase()} @@ -137,7 +141,7 @@ export function ProblemCreateContainer() { setChecklistCnt((prev) => (prev > 5 ? prev - 1 : prev + 1)) } type="button" - className="itmes-center border-primary-light hover:bg-color-blue-95 flex h-12 gap-[6px] rounded-lg border-[1.4px] bg-white px-5 py-[13px]" + className="border-primary-light hover:bg-color-blue-95 flex h-12 items-center gap-[6px] rounded-lg border-[1.4px] bg-white px-5 py-[13px]" >

저장하기

diff --git a/apps/frontend/app/(client)/(main)/(create)/problem/create/_components/StatementPage.tsx b/apps/frontend/app/(client)/(main)/(create)/problem/create/_components/StatementPage.tsx index 23ef7dd999..a114e5fd38 100644 --- a/apps/frontend/app/(client)/(main)/(create)/problem/create/_components/StatementPage.tsx +++ b/apps/frontend/app/(client)/(main)/(create)/problem/create/_components/StatementPage.tsx @@ -1,3 +1,251 @@ +import { Button } from '@/components/shadcn/button' +import { Input } from '@/components/shadcn/input' +import { LucideCircleMinus } from 'lucide-react' +import { useRef } from 'react' +import { Controller, useFieldArray, useForm } from 'react-hook-form' + +interface StatementForm { + basicInfo: { + title: string + timeLimit?: number + memoryLimit?: number + } + problemInfo: { + description: string + input: string + output: string + } + samples: { sampleId: number; input: string; output: string }[] +} + +// 머지 전에 +// 1. 개별 샘플 삭제 디자인 컨펌 +// 2. problem container 배경색 원복 export function StatementPage() { - return
This is Statement page
+ const sampleIdRef = useRef(1) + + const { control, register, handleSubmit } = useForm({ + defaultValues: { + basicInfo: { + title: '', + timeLimit: undefined, + memoryLimit: undefined + }, + problemInfo: { + description: '', + input: '', + output: '' + }, + samples: [ + { + sampleId: 1, + input: '', + output: '' + } + ] + } + }) + + const { fields, append, remove } = useFieldArray({ + control, + name: 'samples' + }) + + // TODO: 올바른 제출 로직 구현 (추후 백엔드 연동 시) + const submitForm = handleSubmit((data) => { + console.log(data) + }) + + const appendSample = () => { + append({ sampleId: ++sampleIdRef.current, input: '', output: '' }) + } + + const removeSample = (idx: number) => { + remove(idx) + } + + return ( +
+
+
+
+ 기본 정보 +
+
+
+ + ( + + )} + /> +
+
+
+ + ( + + )} + /> +
+
+ + ( + + )} + /> +
+
+
+
+
+
+ 문제 +
+
+
+ +