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 && ( + + )} + +
+
+
+ ); +}