From b54e34feba6ba0f8ef264411555b84de7514697b Mon Sep 17 00:00:00 2001 From: gahusb Date: Sat, 16 May 2026 05:22:43 +0900 Subject: [PATCH] =?UTF-8?q?feat(gyeol):=20QuestionLayout=20=E2=80=94=20?= =?UTF-8?q?=EC=A7=88=EB=AC=B8=20=EB=8B=A8=EA=B3=84=20=EA=B3=B5=ED=86=B5=20?= =?UTF-8?q?wrapper?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ProgressBar + 헤더 + 본문 slot + 이전/다음 네비게이션. nextDisabled로 validation 제어. submitting 시 버튼 비활성. Co-Authored-By: Claude Opus 4.7 (1M context) --- app/gyeol/components/QuestionLayout.tsx | 74 +++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 app/gyeol/components/QuestionLayout.tsx diff --git a/app/gyeol/components/QuestionLayout.tsx b/app/gyeol/components/QuestionLayout.tsx new file mode 100644 index 0000000..69ef139 --- /dev/null +++ b/app/gyeol/components/QuestionLayout.tsx @@ -0,0 +1,74 @@ +'use client'; + +import type { ReactNode } from 'react'; +import ProgressBar from './ProgressBar'; +import type { SurveyStep } from '@/lib/survey/types'; +import { QUESTION_HEADERS } from '@/lib/survey/questions'; + +interface Props { + step: SurveyStep; + children: ReactNode; // 본문 (옵션 입력 컴포넌트) + onPrev?: () => void; // 이전 (없으면 미렌더) + onNext: () => void; // 다음 + nextLabel?: string; // 기본 '다음' + nextDisabled?: boolean; + submitting?: boolean; // Q7 전송 중 표시 +} + +export default function QuestionLayout({ + step, + children, + onPrev, + onNext, + nextLabel = '다음', + nextDisabled = false, + submitting = false, +}: Props) { + const header = QUESTION_HEADERS[step]; + + return ( +
+ + +
+ {/* 질문 헤더 */} +
+

+ {header?.title} +

+ {header?.subtitle && ( +

{header.subtitle}

+ )} +
+ + {/* 본문 */} +
{children}
+ + {/* 네비게이션 */} +
+ {onPrev && ( + + )} + +
+
+
+ ); +}