-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3332300
commit c5acb15
Showing
11 changed files
with
163 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,30 @@ | ||
import { Intro } from '@/components/intro'; | ||
import { Policy } from '@/components/policy'; | ||
import { UserInfoForm } from '@/components/user-info-form'; | ||
import { StepOne } from '@/components/home/step-one'; | ||
import { StepTwo } from '@/components/home/step-two'; | ||
import { Button } from '@/components/ui/button'; | ||
import Link from 'next/link'; | ||
import { redirect } from 'next/navigation'; | ||
|
||
export default function HomePage({ | ||
searchParams, | ||
}: { | ||
searchParams: { step: string }; | ||
}) { | ||
if (!searchParams.step) { | ||
redirect('/?step=1'); | ||
} | ||
|
||
export default function HomePage() { | ||
return ( | ||
<div className="bg-sub-2 flex min-h-screen w-full flex-col gap-2.5 p-5"> | ||
<Intro /> | ||
<Policy /> | ||
<UserInfoForm /> | ||
<div className="flex min-h-screen w-full flex-col gap-2.5 bg-sub-2 p-5"> | ||
{searchParams.step === '1' ? <StepOne /> : null} | ||
{searchParams.step === '2' ? <StepTwo /> : null} | ||
<Link href="/?step=2" className="mb-4 mt-[30px]"> | ||
<Button | ||
variant="default" | ||
className="head3 flex h-12 w-full items-center justify-center rounded-[10px] text-white hover:bg-primary hover:opacity-90" | ||
> | ||
{searchParams.step === '1' ? '다음으로' : '제출하기'} | ||
</Button> | ||
</Link> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Intro } from '@/components/intro'; | ||
import { Policy } from '@/components/policy'; | ||
|
||
export function StepOne() { | ||
return ( | ||
<> | ||
<Intro /> | ||
<Policy /> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { MultipleChoice } from '../multiple-choice'; | ||
import { SingleChoice } from '../single-choice'; | ||
import { Badge } from '../ui/badge'; | ||
import { Card } from '../ui/card'; | ||
import { UserInfoForm } from '../user-info-form'; | ||
|
||
const DUMMY_DATA = [ | ||
{ id: 'q1', text: '선택지 1' }, | ||
{ id: 'q2', text: '선택지 2' }, | ||
{ id: 'q3', text: '선택지 3' }, | ||
{ id: 'q4', text: '선택지 4' }, | ||
]; | ||
|
||
export function StepTwo() { | ||
return ( | ||
<> | ||
<UserInfoForm /> | ||
<Card className="flex flex-col gap-5"> | ||
<Badge>객관식 (복수선택)</Badge> | ||
<h2 className="body1 px-1.5 text-gray-600"> | ||
1. 어떤 음식을 먹고 싶나요? | ||
</h2> | ||
<MultipleChoice choices={DUMMY_DATA} /> | ||
</Card> | ||
<Card className="flex flex-col gap-5"> | ||
<Badge>객관식 (단일선택)</Badge> | ||
<h2 className="body1 px-1.5 text-gray-600"> | ||
2. 학교에 조리 시설이 있나요? | ||
</h2> | ||
<SingleChoice q1="y" q2="n" q1Text="네" q2Text="아니요" /> | ||
</Card> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
'use client'; | ||
|
||
import { useState } from 'react'; | ||
import { Box } from './ui/box'; | ||
import { CheckBox } from './ui/check-box'; | ||
|
||
type ChoiceType = { | ||
id: string; | ||
text: string; | ||
}; | ||
|
||
type MultipleChoiceType = { | ||
choices: ChoiceType[]; | ||
}; | ||
|
||
export function MultipleChoice({ choices }: MultipleChoiceType) { | ||
const [selected, setSelected] = useState<string[]>([]); | ||
|
||
const toggleSelection = (id: string) => { | ||
setSelected(prev => | ||
prev.includes(id) ? prev.filter(item => item !== id) : [...prev, id] | ||
); | ||
}; | ||
|
||
return ( | ||
<div className="flex w-full flex-col gap-2.5"> | ||
{choices.map(choice => ( | ||
<Box | ||
key={choice.id} | ||
className="flex items-center gap-3 md:w-full" | ||
onClick={() => toggleSelection(choice.id)} | ||
isActive={selected.includes(choice.id)} | ||
> | ||
<CheckBox | ||
isChecked={selected.includes(choice.id)} | ||
className="rounded-[5px]" | ||
/> | ||
<span className="body3 text-[#3B404E]">{choice.text}</span> | ||
</Box> | ||
))} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
'use client'; | ||
|
||
import { useState } from 'react'; | ||
import { Box } from './ui/box'; | ||
import { CheckBox } from './ui/check-box'; | ||
|
||
type SingleChoiceType = { | ||
q1: string; | ||
q2: string; | ||
q1Text: string; | ||
q2Text: string; | ||
}; | ||
|
||
export function SingleChoice({ q1, q2, q1Text, q2Text }: SingleChoiceType) { | ||
const [select, setSelect] = useState<string>(''); | ||
|
||
return ( | ||
<div className="flex w-full flex-col gap-2.5"> | ||
<Box | ||
className="flex items-center gap-3 md:w-full" | ||
onClick={() => setSelect(q1)} | ||
isActive={select === q1} | ||
> | ||
<CheckBox isChecked={select === q1} /> | ||
<span className="body3 text-[#3B404E]">{q1Text}</span> | ||
</Box> | ||
<Box | ||
className="flex items-center gap-3 md:w-full" | ||
onClick={() => setSelect(q2)} | ||
isActive={select === q2} | ||
> | ||
<CheckBox isChecked={select === q2} /> | ||
<span className="body3 text-[#3B404E]">{q2Text}</span> | ||
</Box> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters