-
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.
* feat: 회원가입 뷰 퍼블리싱 * feat: 로그인 뷰 퍼블리싱 * rename: 디렉토리명 수정 * rename: 디렉토리명 수정 * fix: 로그인/ 회원가입 버튼 위치 수정 및 오류 해결 --------- Co-authored-by: asdf99245 <asdf99245@naver.com>
- Loading branch information
Showing
9 changed files
with
180 additions
and
8 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import Image from 'next/image'; | ||
import { useRouter } from 'next/router'; | ||
import { useForm } from 'react-hook-form'; | ||
import { Button, Input } from '@/components/shared'; | ||
|
||
export default function SignInPage() { | ||
const router = useRouter(); | ||
const { | ||
formState: { isValid }, | ||
register, | ||
handleSubmit, | ||
} = useForm(); | ||
|
||
const onSubmit = (data: object) => { | ||
// NOTE: 로그인 API 연결 | ||
const uuid = 1111; | ||
router.push(`/user/${uuid}`); | ||
}; | ||
|
||
const { ref: idRef, onChange: onIdChange } = register('id', { required: true }); | ||
const { ref: pwRef, onChange: onPwChange } = register('password', { required: true, minLength: 4 }); | ||
|
||
return ( | ||
<div className='tw-relative tw-flex tw-h-[100vh] tw-w-full tw-flex-col tw-bg-white tw-px-5 tw-py-8'> | ||
<div className='mb-10 tw-mb-11 tw-flex tw-items-center tw-gap-2'> | ||
<Image alt='logo' src='/logo.svg' width={32} height={32} /> | ||
<h1 className='tw-text-logo'>Grafi</h1> | ||
</div> | ||
<form onSubmit={handleSubmit(onSubmit)} className='tw-flex tw-flex-1 tw-flex-col tw-justify-between'> | ||
<div className='tw-flex tw-flex-col tw-gap-10'> | ||
<Input | ||
inputKey='id' | ||
label='아이디' | ||
caption='영문 소문자, 숫자만 입력 가능' | ||
placeholder='아이디를 입력해주세요' | ||
maxLength={15} | ||
ref={idRef} | ||
handleChange={onIdChange} | ||
/> | ||
<Input | ||
type='password' | ||
inputKey='password' | ||
label='비밀번호' | ||
caption='숫자만 입력 가능' | ||
placeholder='비밀번호 4자리를 입력해주세요' | ||
maxLength={4} | ||
ref={pwRef} | ||
handleChange={onPwChange} | ||
/> | ||
</div> | ||
|
||
<Button disabled={!isValid} className='tw-w-full tw-justify-center'> | ||
로그인하기 | ||
</Button> | ||
</form> | ||
</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,72 @@ | ||
import Image from 'next/image'; | ||
import { useRouter } from 'next/router'; | ||
import { useForm } from 'react-hook-form'; | ||
import { isString } from '@/utils'; | ||
import { Button, Input } from '@/components/shared'; | ||
|
||
export default function SignUpPage() { | ||
const router = useRouter(); | ||
const { | ||
formState: { isValid, errors }, | ||
register, | ||
handleSubmit, | ||
setError, | ||
} = useForm(); | ||
|
||
// NOTE: ID 체크 API 연결 예정 | ||
const checkValidID = () => { | ||
return false; | ||
}; | ||
|
||
const onSubmit = (data: object) => { | ||
const isValidID = checkValidID(); | ||
if (isValidID) { | ||
// NOTE : 회원가입 요청 API 후 uuid값 리턴받음 | ||
const uuid = '1111'; | ||
router.push(`/user/${uuid}`); | ||
return; | ||
} | ||
setError('id', { message: '이미 사용 중인 아이디입니다' }, { shouldFocus: true }); | ||
}; | ||
|
||
const { ref: idRef, onChange: onIdChange } = register('id', { required: true }); | ||
const { ref: pwRef, onChange: onPwChange } = register('password', { required: true, minLength: 4 }); | ||
|
||
return ( | ||
<div className='tw-relative tw-flex tw-h-[100vh] tw-w-full tw-flex-col tw-bg-white tw-px-5 tw-py-8'> | ||
<div className='mb-10 tw-mb-11 tw-flex tw-items-center tw-gap-2'> | ||
<Image alt='logo' src='/logo.svg' width={32} height={32} /> | ||
<h1 className='tw-text-logo'>Grafi</h1> | ||
</div> | ||
<form onSubmit={handleSubmit(onSubmit)} className='tw-flex tw-flex-1 tw-flex-col tw-justify-between'> | ||
<div className='tw-flex tw-flex-col tw-gap-10'> | ||
<Input | ||
inputKey='id' | ||
label='아이디' | ||
captionPosition='top' | ||
caption='영문 소문자, 숫자만 입력 가능' | ||
feedback={isString(errors.id?.message) ? errors.id?.message : ''} | ||
placeholder='아이디를 입력해주세요' | ||
maxLength={15} | ||
ref={idRef} | ||
handleChange={onIdChange} | ||
/> | ||
<Input | ||
type='password' | ||
inputKey='password' | ||
label='비밀번호' | ||
captionPosition='top' | ||
caption='숫자만 입력 가능' | ||
placeholder='비밀번호 4자리를 입력해주세요' | ||
maxLength={4} | ||
ref={pwRef} | ||
handleChange={onPwChange} | ||
/> | ||
</div> | ||
<Button disabled={!isValid} className='tw-w-full tw-justify-center'> | ||
회원가입 | ||
</Button> | ||
</form> | ||
</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