-
Notifications
You must be signed in to change notification settings - Fork 44
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
[장문원] week14 #451
Merged
1005hoon
merged 17 commits into
codeit-bootcamp-frontend:part3-장문원
from
jangmoonwon:part3-장문원-week14
May 22, 2024
The head ref may contain hidden characters: "part3-\uC7A5\uBB38\uC6D0-week14"
Merged
[장문원] week14 #451
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
291f1f0
feat: 기초 세팅
jangmoonwon 60c1636
chore: 라이브러리 설치
jangmoonwon f91cb50
feat: scss 설정
jangmoonwon ef2710e
feat: 이미지 추가
jangmoonwon 8fdff1c
feat: axios 인스턴스 생성
jangmoonwon dfc234d
feat: 로그인 페이지 레이아웃 생성
jangmoonwon faa6a8d
feat: 로그인 페이지 생성
jangmoonwon 4cc8273
feat: 회원가입 페이지 생성
jangmoonwon 084aca3
feat: 메인 페이지 생성
jangmoonwon 571644d
feat: 폴더 페이지 생성
jangmoonwon d777873
Refactor: 불필요 코드 삭제
jangmoonwon a74df59
feat: LoginHeader 컴포넌트 생성
jangmoonwon fbf5e9f
feat: SocialBox 컴포넌트 생성
jangmoonwon ad2251a
chore: 불필요 라인 삭제
jangmoonwon 78b5907
Refactor: schema 유효성 검사 유틸 분리
jangmoonwon 65a5858
refactor: 분리한 schema, 컴포넌트들 적용
jangmoonwon 6d4d8f6
style: 불필요 스타일 코드 삭제
jangmoonwon 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 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,12 @@ | ||
@import "@/styles/global.scss"; | ||
|
||
.container { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
gap: 3rem; | ||
width: 100%; | ||
height: 100vh; | ||
background-color: $color-background; | ||
} |
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,13 @@ | ||
import { ReactNode } from "react"; | ||
import styles from "./LoginLayout.module.scss"; | ||
import classNames from "classnames/bind"; | ||
|
||
interface LoginLayoutProps { | ||
children: ReactNode; | ||
} | ||
|
||
const cx = classNames.bind(styles); | ||
|
||
export const LoginLayout = ({ children }: LoginLayoutProps) => { | ||
return <div className={cx("container")}>{children}</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,24 @@ | ||
@import "@/styles/global.scss"; | ||
|
||
.header-container { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 1.6rem; | ||
} | ||
|
||
.header-content { | ||
display: flex; | ||
gap: 0.8rem; | ||
} | ||
|
||
.header-message { | ||
font-size: 1.6rem; | ||
font-weight: 400; | ||
} | ||
|
||
.header-link { | ||
font-size: 1.6rem; | ||
font-weight: 600; | ||
color: $color-primary; | ||
border-bottom: 0.1rem solid $color-primary; | ||
} |
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,33 @@ | ||
import styles from "./LoginHeader.module.scss"; | ||
import classNames from "classnames/bind"; | ||
import Link from "next/link"; | ||
import Image from "next/image"; | ||
import Logo from "@/public/logo.svg"; | ||
|
||
const cx = classNames.bind(styles); | ||
|
||
interface LoginHeaderProps { | ||
href: string; | ||
message: string; | ||
linkName: string; | ||
} | ||
|
||
export default function LoginHeader({ | ||
href, | ||
message, | ||
linkName, | ||
}: LoginHeaderProps) { | ||
return ( | ||
<header className={cx("header-container")}> | ||
<Link href="/"> | ||
<Image src={Logo} alt="Logo" width={210} height={38} priority /> | ||
</Link> | ||
<div className={cx("header-content")}> | ||
<span className={cx("header-message")}>{message}</span> | ||
<Link href={href} className={cx("header-link")}> | ||
{linkName} | ||
</Link> | ||
</div> | ||
</header> | ||
); | ||
} |
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,24 @@ | ||
@import "@/styles/global.scss"; | ||
|
||
.social-login-container { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
width: 100%; | ||
max-width: 40rem; | ||
padding: 1.2rem 2.4rem; | ||
border: 0.1rem solid $color-grey20; | ||
border-radius: 0.8rem; | ||
background-color: $color-grey10; | ||
} | ||
|
||
.social-login-text { | ||
font-size: 1.4rem; | ||
font-weight: 400; | ||
color: $color-grey100; | ||
} | ||
|
||
.social-login-icon { | ||
display: flex; | ||
gap: 1.6rem; | ||
} |
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,24 @@ | ||
import Image from "next/image"; | ||
import Link from "next/link"; | ||
import styles from "./SocialBox.module.scss"; | ||
import classNames from "classnames/bind"; | ||
import Googlelogin from "@/public/Googlelogin.svg"; | ||
import Kakaologin from "@/public/Kakaologin.svg"; | ||
|
||
const cx = classNames.bind(styles); | ||
|
||
export default function SocialBox({ text }: { text: string }) { | ||
return ( | ||
<div className={cx("social-login-container")}> | ||
<span className={cx("social-login-text")}>{text}</span> | ||
<div className={cx("social-login-icon")}> | ||
<Link href="https://www.google.com"> | ||
<Image src={Googlelogin} width={42} height={42} alt="google" /> | ||
</Link> | ||
<Link href="https://www.kakaocorp.com/page"> | ||
<Image src={Kakaologin} width={42} height={42} alt="kakao" /> | ||
</Link> | ||
</div> | ||
</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,64 @@ | ||
import { z } from "zod"; | ||
|
||
const PWD_VALIDATION = /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$/; | ||
|
||
function emailSchema() { | ||
return z | ||
.string() | ||
.min(1, { message: "이메일을 입력해 주세요." }) | ||
.email({ message: "올바른 이메일 주소가 아닙니다." }); | ||
} | ||
|
||
function emailCheckSchema() { | ||
return z | ||
.string() | ||
.min(1, { message: "이메일을 입력해 주세요." }) | ||
.email({ message: "올바른 이메일 주소가 아닙니다." }) | ||
.refine((data) => data !== "test@codeit.com", { | ||
message: "이미 사용 중인 이메일입니다.", | ||
path: ["email"], | ||
}); | ||
} | ||
|
||
function passwordSchema() { | ||
return z | ||
.string() | ||
.min(1, { message: "비밀번호를 입력해 주세요." }) | ||
.max(16, { message: "최대 16자리입니다." }); | ||
} | ||
|
||
function passwordCheckSchema() { | ||
return z | ||
.string() | ||
.min(1, { message: "비밀번호를 입력해 주세요." }) | ||
.max(16, { message: "최대 16자리입니다." }) | ||
.regex(PWD_VALIDATION, { | ||
message: "영문, 숫자를 조합해 8자 이상 입력해 주세요.", | ||
}); | ||
} | ||
|
||
//signin schema | ||
export type FormFields = z.infer<typeof schema>; | ||
|
||
export const schema = z.object({ | ||
email: emailSchema(), | ||
password: passwordSchema(), | ||
}); | ||
|
||
//signup schema | ||
export type FormFieldsCheck = z.infer<typeof schemaCheck>; | ||
|
||
export const schemaCheck = z | ||
.object({ | ||
email: emailCheckSchema(), | ||
password: passwordCheckSchema(), | ||
passwordCheck: passwordCheckSchema(), | ||
}) | ||
.refine((data) => data.email !== "test@codeit.com", { | ||
message: "이미 사용 중인 이메일입니다.", | ||
path: ["email"], | ||
}) | ||
.refine((data) => data.password === data.passwordCheck, { | ||
message: "비밀번호가 일치하지 않아요.", | ||
path: ["passwordCheck"], | ||
}); |
Oops, something went wrong.
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.
@jangmoonwon
음 각 필드 요소에 대해 스키마를 짜기보단,
user가 지녀야 하는 정보에 대한 스키마라면 userSchema로,
로그인 인증을 위해 필요한 데이터 스키마라면 loginAuthSchema로,
회원가입을 위해 필요한 스키마라면 registerAuthSchema로 구분짓는게 좋겠어요