-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/95 회원가입 페이지 UI 구현 #97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
JunJongHun
wants to merge
2
commits into
develop
Choose a base branch
from
feat/95
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,7 +1,115 @@ | ||
| import React from 'react'; | ||
| import styles from './styles.module.scss'; | ||
| import { SubmitHandler, useForm } from 'react-hook-form'; | ||
|
|
||
| function SignUp() { | ||
| return <div>회원가입 컴포넌트</div>; | ||
| type SignUpPropsType = { | ||
| setIsSginUp: React.Dispatch<React.SetStateAction<boolean>>; | ||
| }; | ||
|
|
||
| type InputsType = { | ||
| nickname: string; | ||
| id: string; | ||
| password: string; | ||
| passwordCheck: string; | ||
| }; | ||
|
|
||
| function SignUp({ setIsSginUp }: SignUpPropsType) { | ||
| const { | ||
| register, | ||
| handleSubmit, | ||
| watch, | ||
| formState: { errors }, | ||
| } = useForm<InputsType>(); | ||
|
|
||
| const onSubmit: SubmitHandler<InputsType> = async (data: InputsType) => { | ||
| console.info(data); | ||
| // TODO: 실제 로그인 로직을 수행하고, 서버로부터 JWT 토큰을 받는다. | ||
| }; | ||
|
|
||
| return ( | ||
| <article className={styles.container}> | ||
| <form className={styles.form} onSubmit={handleSubmit(onSubmit)}> | ||
| <div> | ||
| <label htmlFor="nickname">닉네임</label> | ||
| <input | ||
| id="nickname" | ||
| type="text" | ||
| defaultValue={watch('nickname')} | ||
| placeholder={'닉네임을 입력하세요.'} | ||
| {...register('nickname', { | ||
| required: { | ||
| value: true, | ||
| message: '닉네임은 필수 입력항목입니다.', | ||
| }, | ||
| })} | ||
| ></input> | ||
| {errors.nickname && <span>{errors.nickname.message}</span>} | ||
| </div> | ||
|
|
||
| <div> | ||
| <label htmlFor="id">아이디</label> | ||
| <input | ||
| id="id" | ||
| type="text" | ||
| defaultValue={watch('id')} | ||
| placeholder={'아이디를 입력하세요.'} | ||
| {...register('id', { | ||
| required: { | ||
| value: true, | ||
| message: '아이디는 필수 입력항목입니다.', | ||
| }, | ||
| })} | ||
| ></input> | ||
| {errors.id && <span>{errors.id.message}</span>} | ||
| </div> | ||
| <div> | ||
| <label htmlFor="password">비밀번호</label> | ||
| <input | ||
| id="password" | ||
| type="password" | ||
| defaultValue={watch('password')} | ||
| placeholder={'비밀번호를 입력하세요.'} | ||
| {...register('password', { | ||
| required: { | ||
| value: true, | ||
| message: '비밀번호는 필수 입력항목입니다.', | ||
| }, | ||
| })} | ||
| ></input> | ||
| {errors.password && <span>{errors.password.message}</span>} | ||
| </div> | ||
|
|
||
| <div> | ||
| <label htmlFor="passwordCheck">비밀번호 재확인</label> | ||
| <input | ||
| id="passwordCheck" | ||
| type="password" | ||
| defaultValue={watch('passwordCheck')} | ||
| placeholder={'비밀번호 재입력하세요.'} | ||
| {...register('passwordCheck', { | ||
| required: { | ||
| value: true, | ||
| message: '비밀번호 재확인은 필수 입력항목입니다.', | ||
| }, | ||
| })} | ||
| ></input> | ||
| {errors.passwordCheck && <span>{errors.passwordCheck.message}</span>} | ||
| </div> | ||
|
|
||
| <button type="submit">회원가입</button> | ||
| <p> | ||
| 아이디가 기억나셨나요?{' '} | ||
| <span | ||
| onClick={() => { | ||
| setIsSginUp((pre) => !pre); | ||
| }} | ||
| > | ||
| 로그인 | ||
| </span> | ||
| </p> | ||
| </form> | ||
| </article> | ||
| ); | ||
| } | ||
|
|
||
| export default SignUp; | ||
This file contains hidden or 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,74 @@ | ||
| .container { | ||
| display: flex; | ||
| flex-direction: column; | ||
| align-items: center; | ||
| gap: 3rem; | ||
| background-color: white; | ||
| } | ||
|
|
||
| .form { | ||
| display: flex; | ||
| flex-direction: column; | ||
| width: 100%; | ||
| gap: 2rem; | ||
| & > div { | ||
| display: flex; | ||
| flex-direction: column; | ||
|
|
||
| & > label { | ||
| margin-bottom: 1rem; | ||
| } | ||
| & > input { | ||
| @media screen and (max-width: 768px) { | ||
| height: auto; | ||
| padding: 3rem 1.5rem; | ||
| } | ||
| width: 100%; | ||
| height: 4.9rem; | ||
| padding: 0 1.5rem; | ||
| margin-bottom: 1rem; | ||
| font-weight: 500; | ||
| outline: none; | ||
| background: #f9f9f9; | ||
| box-shadow: 0px 1px 2px 3px rgba(0, 0, 0, 0.15), | ||
| 0px 1px 1px rgba(0, 0, 0, 0.3); | ||
| border-radius: 4px; | ||
| } | ||
| & > span { | ||
| color: red; | ||
| font-size: 1.2rem; | ||
| } | ||
| } | ||
|
|
||
| & > button { | ||
| align-self: center; | ||
| width: 18rem; | ||
| height: 4.9rem; | ||
| margin-top: 5rem; | ||
| cursor: pointer; | ||
| color: white; | ||
| border: none; | ||
| background: #ff6835; | ||
| border-radius: 100px; | ||
| &:hover { | ||
| opacity: 0.8; | ||
| } | ||
| } | ||
|
|
||
| & > p { | ||
| align-self: center; | ||
| margin-top: 1rem; | ||
| font-size: 1.4rem; | ||
| color: #cecece; | ||
|
|
||
| & > span { | ||
| font-weight: 600; | ||
| cursor: pointer; | ||
| color: #ff6835; | ||
| &:hover { | ||
| text-decoration: underline; | ||
| opacity: 0.8; | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여기에는 useForm이라는 새로운 Hook이 하나가 보이네요! 혹시 이건 직관적으로 해석한 것처럼 폼과 관련된 훅인건가요??