-
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.
Merge pull request #218 from boostcampwm2023/feature/signup-animation
feat: 회원가입 화면 애니메이션 구현
- Loading branch information
Showing
8 changed files
with
226 additions
and
93 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
43 changes: 30 additions & 13 deletions
43
frontend/src/components/account/JobInput.tsx → .../src/components/account/PositionInput.tsx
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,45 +1,62 @@ | ||
import { useEffect } from "react"; | ||
import useDropdown from "../../hooks/common/dropdown/useDropdown"; | ||
import { JOB_INPUT_INFO, SIGNUP_STEP } from "../../constants/account"; | ||
import NextStepButton from "./NextStepButton"; | ||
import { JOB_INPUT_INFO, SIGNUP_STEP } from "../../constants/account"; | ||
|
||
interface JobInputProps { | ||
setCurrentStep: React.Dispatch<React.SetStateAction<{ NUMBER: number; NAME: string }>>; | ||
jobRef: React.MutableRefObject<string | null>; | ||
currentStepNumber: number; | ||
setCurrentStep: React.Dispatch< | ||
React.SetStateAction<{ NUMBER: number; NAME: string }> | ||
>; | ||
positionRef: React.MutableRefObject<string | null>; | ||
} | ||
|
||
const JobInput = ({ setCurrentStep, jobRef }: JobInputProps) => { | ||
const PositionInput = ({ | ||
currentStepNumber, | ||
setCurrentStep, | ||
positionRef, | ||
}: JobInputProps) => { | ||
const { Dropdown, selectedOption } = useDropdown({ | ||
placeholder: JOB_INPUT_INFO.PLACEHOLDER, | ||
options: JOB_INPUT_INFO.OPTIONS, | ||
}); | ||
|
||
const handleNextButtonClick = () => { | ||
setCurrentStep(SIGNUP_STEP.STEP3); | ||
const techElement = document.getElementById("tech"); | ||
techElement?.scrollIntoView({ behavior: "smooth", block: "nearest" }); | ||
}; | ||
|
||
useEffect(() => { | ||
jobRef.current = selectedOption; | ||
positionRef.current = selectedOption; | ||
}, [selectedOption]); | ||
|
||
return ( | ||
<div id="job" className="h-[100%] flex items-center"> | ||
<div className="w-[80%] flex gap-4 items-center"> | ||
<span className="text-3xl font-semibold text-dark-gray">저의 주요 직무는</span> | ||
<div | ||
className={`flex h-[90%] ${ | ||
currentStepNumber !== SIGNUP_STEP.STEP3.NUMBER | ||
? "items-center" | ||
: "items-end" | ||
}`} | ||
> | ||
<div id="position-input-box" className="w-[80%] flex gap-4 items-center"> | ||
<span className="text-3xl font-semibold text-dark-gray"> | ||
저의 주요 직무는 | ||
</span> | ||
<Dropdown | ||
buttonClassName={`w-[14.25rem] h-[3.25rem] rounded-xl bg-middle-green text-white text-m shadow-box ${ | ||
buttonClassName={`w-[14.25rem] min-h-[3.25rem] rounded-xl bg-middle-green text-white text-m shadow-box ${ | ||
selectedOption && "font-bold" | ||
}`} | ||
containerClassName="w-[14.25rem] h-[18.5rem] overflow-y-auto shadow-box" | ||
itemClassName="text-2xl text-text-gray py-3 px-9 hover:bg-middle-green hover:text-white hover:font-bold" | ||
/> | ||
<span className="text-3xl font-semibold text-dark-gray">입니다</span> | ||
</div> | ||
<NextStepButton onNextButtonClick={handleNextButtonClick}>Next</NextStepButton> | ||
{currentStepNumber !== SIGNUP_STEP.STEP3.NUMBER && ( | ||
<NextStepButton onNextButtonClick={handleNextButtonClick}> | ||
Next | ||
</NextStepButton> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default JobInput; | ||
export default PositionInput; |
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,85 @@ | ||
import { useEffect, useRef } from "react"; | ||
import NicknameInput from "./NicknameInput"; | ||
import PositionInput from "./PositionInput"; | ||
import TechStackInput from "./TechStackInput"; | ||
import { SIGNUP_STEP } from "../../constants/account"; | ||
|
||
interface SignupMainSectionProps { | ||
currentStepNumber: number; | ||
setCurrentStep: React.Dispatch< | ||
React.SetStateAction<{ NUMBER: number; NAME: string }> | ||
>; | ||
} | ||
|
||
const SignupMainSection = ({ | ||
currentStepNumber, | ||
setCurrentStep, | ||
}: SignupMainSectionProps) => { | ||
const nicknameRef = useRef<string>(""); | ||
const positionRef = useRef<string | null>(null); | ||
const techRef = useRef<string[]>([]); | ||
|
||
const handlePrevStepAreaClick = () => { | ||
setCurrentStep((prevStep) => { | ||
if (prevStep.NUMBER === SIGNUP_STEP.STEP3.NUMBER) { | ||
return SIGNUP_STEP.STEP2; | ||
} | ||
|
||
if (prevStep.NUMBER === SIGNUP_STEP.STEP2.NUMBER) { | ||
return SIGNUP_STEP.STEP1; | ||
} | ||
|
||
return prevStep; | ||
}); | ||
}; | ||
|
||
const handleSignupButtonClick = () => {}; | ||
|
||
useEffect(() => { | ||
const nicknameInput = document.getElementById("nickname"); | ||
const nicknameInputElement = document.getElementById("nickname-input-box"); | ||
const techStackInput = document.getElementById("tech"); | ||
|
||
switch (currentStepNumber) { | ||
case SIGNUP_STEP.STEP1.NUMBER: | ||
nicknameInput?.scrollIntoView({ behavior: "smooth", block: "center" }); | ||
break; | ||
|
||
case SIGNUP_STEP.STEP2.NUMBER: | ||
nicknameInputElement?.scrollIntoView({ | ||
behavior: "smooth", | ||
block: "start", | ||
}); | ||
break; | ||
|
||
case SIGNUP_STEP.STEP3.NUMBER: | ||
techStackInput?.scrollIntoView({ behavior: "smooth", block: "center" }); | ||
break; | ||
} | ||
}, [currentStepNumber]); | ||
|
||
return ( | ||
<main className="relative ml-10 pl-7 w-[100%] h-[40.5rem]"> | ||
<div | ||
className={`absolute top-0 bg-gradient-to-b from-white to-90% min-w-[90%] min-h-[9.25rem] z-10 ${ | ||
currentStepNumber > 1 && "hover:cursor-pointer" | ||
}`} | ||
onClick={handlePrevStepAreaClick} | ||
></div> | ||
<section className="h-[100%] overflow-y-hidden"> | ||
<NicknameInput | ||
{...{ currentStepNumber, setCurrentStep, nicknameRef }} | ||
/> | ||
<PositionInput | ||
{...{ currentStepNumber, setCurrentStep, positionRef }} | ||
/> | ||
<TechStackInput | ||
{...{ setCurrentStep, techRef }} | ||
onSignupButtonClick={handleSignupButtonClick} | ||
/> | ||
</section> | ||
</main> | ||
); | ||
}; | ||
|
||
export default SignupMainSection; |
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
Oops, something went wrong.