Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/components/trip/QuestionStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@ export default function QuestionStep({
const { draft, setAnswer } = useTripDraft();
const [questions, setQuestions] = useState<TripQuestion[] | null>(null);
const [error, setError] = useState(false);
const backHref =
uiStep === 3
? "/trips/new/step2"
: uiStep === 2
? "/trips/new/step1"
: "/trips/new/date";

useEffect(() => {
let cancelled = false;
Expand Down Expand Up @@ -271,7 +277,7 @@ export default function QuestionStep({

return (
<PageFade className="flex min-h-0 flex-1 flex-col bg-[#fbfdff]">
<StepProgress step={stepIndex} total={total} title={headerTitle} />
<StepProgress step={stepIndex} total={total} title={headerTitle} backHref={backHref} />

<div className="flex min-h-0 flex-1 flex-col overflow-y-auto px-5 pb-6 scrollbar-none">
<section className="relative -mx-5 min-h-[10.5rem] overflow-hidden px-5 pt-8">
Expand Down
4 changes: 3 additions & 1 deletion src/components/ui/StepProgress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ export default function StepProgress({
step,
total,
title,
backHref,
}: {
step: number;
total: number;
title?: string;
backHref?: string;
}) {
const router = useRouter();
const percent = (step / total) * 100;
Expand All @@ -20,7 +22,7 @@ export default function StepProgress({
<div className="flex items-center justify-between gap-2">
<button
type="button"
onClick={() => router.back()}
onClick={() => backHref ? router.replace(backHref) : router.back()}
aria-label="뒤로 가기"
className="-ml-2 grid size-10 shrink-0 place-items-center rounded-full text-[#0d234f] transition-colors hover:bg-[#eef5ff]"
>
Expand Down
Loading