-
Notifications
You must be signed in to change notification settings - Fork 1
Feat(#17): 로그인 화면 && sign-in 페이지 구현 #19
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
meowTarae
wants to merge
16
commits into
Sprint/7
Choose a base branch
from
feat/17/signInPage
base: Sprint/7
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
16 commits
Select commit
Hold shift + click to select a range
8098f93
Feat(#17): Logo Icon 추가
meowTarae 8a06c2d
Feat(#17): 로그인 시 사용되는 social icons 추가
meowTarae 95b872d
Refactor(#17): SignUpButton 타입 분리 리팩토링
meowTarae e93a3ba
Feat(#17): SignUpButton에 classname props 추가
meowTarae 49df01c
Feat(#17): 로그인 상수값들 추가
meowTarae 0cb7ac4
Feat(#17): 로그인 페이지 구현
meowTarae eea1751
Feat(#17): 휴대전화 버튼 클릭 시 로그인 페이지로 이동
meowTarae 9ebeb85
Feat(#17): Input 컴포넌트 autoComplete 속성 추가
meowTarae 5c833ca
Feat(#17): 로그인 페이지 ui 구현
meowTarae 506842d
Feat(#17): 입력받은 state 관리를 useState에서 rhf로 변경
meowTarae b7018ed
Typo(#17): icon 오기재된 경로 수정
meowTarae 0e7da02
Feat(#17): rhf 를 적용한 비밀번호 Input 구현
meowTarae 8d4e9d5
Style(#17): Card 공통 컴포넌트 title의 html 태그 변경
meowTarae c79c936
Feat(#17): 로그인 유지 & 비밀번호 재설정 구현
meowTarae 9d2b71e
Feat(#17): 로그인 버튼 & 회원가입 버튼 구현
meowTarae ce3ad3d
Refactor(#17): 페이지 내부 타입을 분리 리팩토링
meowTarae 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 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,3 +1,49 @@ | ||
| import SignupButton from "@/components/feature/SignInPage/SignupButton"; | ||
| import { SIGNUP_BUTTON_TYPES } from "@/constants/signUpButtonType"; | ||
| import Image from "next/image"; | ||
|
|
||
| export default function SignInPage() { | ||
| return <div>SignInPage</div>; | ||
| return ( | ||
| <section className='w-[425px]'> | ||
| {/* Logo */} | ||
| <h1 | ||
| aria-label='logo' | ||
| className='flex justify-center' | ||
| > | ||
| <Image | ||
| src={"/icons/logo.svg"} | ||
| alt='logo' | ||
| width={196} | ||
| height={36} | ||
| className='antialiased' | ||
| /> | ||
| </h1> | ||
|
|
||
| {/* 로그인/회원가입 구분선 */} | ||
| <div | ||
| aria-label='sign-divider' | ||
| className='relative mb-14 mt-20 flex items-center' | ||
| > | ||
| <div className='flex-grow border-t border-gray-300' /> | ||
| <span className='absolute left-1/2 -translate-x-1/2 bg-white px-4 text-sm text-grey-400'> | ||
| 로그인/회원가입 | ||
| </span> | ||
| <div className='flex-grow border-t border-gray-300' /> | ||
| </div> | ||
|
|
||
| {/* 로그인 버튼 */} | ||
| <nav aria-label='sign-in-buttons'> | ||
| <ul> | ||
| {SIGNUP_BUTTON_TYPES.map((button, idx) => ( | ||
| <li key={idx}> | ||
| <SignupButton | ||
| type={button} | ||
| className='mb-4' | ||
| /> | ||
| </li> | ||
| ))} | ||
| </ul> | ||
| </nav> | ||
| </section> | ||
| ); | ||
| } |
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,142 @@ | ||
| "use client"; | ||
|
|
||
| import { useForm } from "react-hook-form"; | ||
| import Input from "@/components/commons/Input"; | ||
| import Link from "next/link"; | ||
| import { useState } from "react"; | ||
| import CheckBox from "@/components/commons/CheckBox"; | ||
| import UnderlineButton from "@/components/commons/UnderlineButton"; | ||
| import Card from "@/components/commons/Card"; | ||
| import Button from "@/components/commons/Button"; | ||
| import { PhoneSignInForm } from "./type"; | ||
|
|
||
| export default function PhoneSignInPage() { | ||
| const { | ||
| register, | ||
| handleSubmit, | ||
| formState: { errors, isSubmitting }, | ||
| watch, | ||
| setValue, | ||
| } = useForm<PhoneSignInForm>({ | ||
| defaultValues: { phone: "", password: "" }, | ||
| mode: "onSubmit", | ||
| }); | ||
| const [isRemember, setIsRemember] = useState(false); | ||
|
|
||
| const phoneValue = watch("phone") || ""; | ||
| const passwordValue = watch("password") || ""; | ||
| const isPhoneError = phoneValue.length > 0 && /\D/.test(phoneValue); | ||
|
|
||
| const onSubmit = (data: PhoneSignInForm) => { | ||
| console.log(isRemember); | ||
| console.log(data); | ||
| }; | ||
|
|
||
| return ( | ||
| <form | ||
| onSubmit={handleSubmit(onSubmit)} | ||
| className='flex w-[378px] flex-col gap-4' | ||
| > | ||
| <h2 className='mb-2 text-body-2'>전화번호로 시작하기</h2> | ||
|
|
||
| {/* 전화번호 */} | ||
| <Input | ||
| type={errors.phone ? "error" : "default"} | ||
| id='phone' | ||
| label='전화번호' | ||
| placeholder='01012345678' | ||
| font='body-5' | ||
| text={phoneValue} | ||
| setText={setValue} | ||
| register={register("phone", { | ||
| required: "전화번호를 입력해주세요.", | ||
| pattern: { | ||
| value: /^(010|011|016|017|018|019)\d{7,8}$/, | ||
| message: "올바른 형식의 전화번호를 입력해 주세요.", | ||
| }, | ||
| })} | ||
| /> | ||
| {isPhoneError && ( | ||
| <span className='text-[14px] text-caution'> | ||
| 숫자만 입력 가능합니다. | ||
| </span> | ||
| )} | ||
| {errors.phone && !isPhoneError && ( | ||
| <span className='text-[14px] text-caution'>{errors.phone.message}</span> | ||
| )} | ||
|
|
||
| {/* 비밀번호 */} | ||
| <Input | ||
| type={errors.password ? "error" : "default"} | ||
| id='password' | ||
| label='비밀번호' | ||
| placeholder='비밀번호를 입력해주세요.' | ||
| font='body-5' | ||
| iconType='password' | ||
| text={passwordValue} | ||
| setText={setValue} | ||
| register={register("password", { | ||
| required: "비밀번호를 입력해주세요.", | ||
| pattern: { | ||
| value: /^.{8,}$/, | ||
| message: "8자 이상 입력해주세요.", | ||
| }, | ||
| })} | ||
| /> | ||
| {errors.password && ( | ||
| <span className='text-[14px] text-caution'> | ||
| {errors.password.message} | ||
| </span> | ||
| )} | ||
|
|
||
| {/* 로그인 유지 & 비밀번호 재설정 */} | ||
| {isRemember && ( | ||
| <Card | ||
| title='주의해 주세요!' | ||
| description='로그인 유지는 개인정보를 위해 개인 기기에서 사용해 주세요.' | ||
| font='caption' | ||
| width={378} | ||
| /> | ||
| )} | ||
|
|
||
| <div className='flex items-center justify-between'> | ||
| <CheckBox | ||
| id='remember' | ||
| text='로그인 유지' | ||
| containerHeight={24} | ||
| boxSize={24} | ||
| isChecked={isRemember} | ||
| onCheck={() => setIsRemember(!isRemember)} | ||
| font='body-5' | ||
| /> | ||
|
|
||
| <Link href='#'> | ||
| <UnderlineButton | ||
| type='passwordReset' | ||
| text='비밀번호 재설정' | ||
| width={100} | ||
| /> | ||
| </Link> | ||
| </div> | ||
|
|
||
| {/* 로그인 버튼 */} | ||
| <Button | ||
| type='checkBasic' | ||
| text='로그인' | ||
| width={378} | ||
| height={56} | ||
| disabled={isSubmitting} | ||
| /> | ||
|
|
||
| <div className='flex items-center justify-center gap-1'> | ||
| <p className='text-grey-400'>계정이 없으신가요?</p> | ||
| <Link href='#'> | ||
| <UnderlineButton | ||
| type='signupEmail' | ||
| text='전화번호로 회원가입' | ||
| /> | ||
| </Link> | ||
| </div> | ||
| </form> | ||
| ); | ||
| } |
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,5 @@ | ||
| export interface PhoneSignInForm { | ||
| phone: string; | ||
| password: string; | ||
| remember: boolean; | ||
| } | ||
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
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
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,72 @@ | ||
| import { SignupButtonProps } from "@/types/components/feature/SignInPage/SignUpButton"; | ||
| import Image from "next/image"; | ||
| import Link from "next/link"; | ||
|
|
||
| export default function SignupButton({ | ||
| type, | ||
| font = "body-5", | ||
| iconSize = 24, | ||
| className, | ||
| }: SignupButtonProps) { | ||
| const buttonTypes = { | ||
| kakao: { | ||
| icon: "/icons/login/kakao.svg", | ||
| text: "text-grey-800", | ||
| background: "bg-[#FEE500]", | ||
| hover: "hover:bg-[#FCDA00]", | ||
| phrase: "카카오로 시작하기", | ||
| }, | ||
| naver: { | ||
| icon: "/icons/login/naver.svg", | ||
| text: "text-white", | ||
| background: "bg-[#03C75A]", | ||
| hover: "hover:bg-[#03C139]", | ||
| phrase: "네이버로 시작하기", | ||
| }, | ||
| facebook: { | ||
| icon: "/icons/login/facebook.svg", | ||
| text: "text-white", | ||
| background: "bg-[#1A77F2]", | ||
| hover: "hover:bg-[#006CE0]", | ||
| phrase: "페이스북으로 시작하기", | ||
| }, | ||
| google: { | ||
| icon: "/icons/login/google.svg", | ||
| text: "text-grey-600", | ||
| background: "bg-white border border-border", | ||
| hover: "hover:bg-background", | ||
| phrase: "구글로 시작하기", | ||
| }, | ||
| phone: { | ||
| icon: "/icons/login/phone.svg", | ||
| text: "text-white", | ||
| background: "bg-primary-400", | ||
| hover: "hover:bg-primary-300", | ||
| phrase: "전화번호로 시작하기", | ||
| }, | ||
| }; | ||
|
|
||
| const currentStyle = buttonTypes[type]; | ||
| const typeClasses = `${currentStyle.background} ${currentStyle.text} ${currentStyle.hover} ${currentStyle.phrase}`; | ||
|
|
||
| const baseClasses = `flex items-center justify-center rounded-xl gap-2 | ||
| w-full h-12 | ||
| focus:outline-none disabled:cursor-not-allowed cursor-pointer truncate text-${font}`; | ||
|
|
||
| const buttonClasses = `${typeClasses} ${baseClasses} ${className}`; | ||
|
|
||
| return ( | ||
| <Link href={`/sign-in/${type}`}> | ||
| <button className={buttonClasses}> | ||
| <Image | ||
| src={currentStyle.icon} | ||
| alt={type} | ||
| width={iconSize} | ||
| height={iconSize} | ||
| className='mb-0.5' | ||
| /> | ||
| <span>{currentStyle.phrase}</span> | ||
| </button> | ||
| </Link> | ||
| ); | ||
| } |
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,9 @@ | ||
| import { ButtonType } from "@/types/components/feature/SignInPage/SignUpButton"; | ||
|
|
||
| export const SIGNUP_BUTTON_TYPES: ButtonType[] = [ | ||
| "kakao", | ||
| "naver", | ||
| "facebook", | ||
| "google", | ||
| "phone", | ||
| ]; |
Oops, something went wrong.
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.
sign-in/phone 페이지와 동일하게
isRemember이 더 나을 것 같습니다!