Skip to content
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

[#8] 회원가입, 로그인 페이지 레이아웃 #27

Merged
merged 31 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
fd5734a
feat: 로그인 페이지 마크업
dabin-Hailey Jan 8, 2024
bf3c2dc
feat: 메인 라우터에 로그인 컴포넌트 추가
dabin-Hailey Jan 8, 2024
7a67ba2
feat: 회원가입 페이지 마크업
dabin-Hailey Jan 8, 2024
b944c23
feat: 메인 라우터에 회원가입 컴포넌트 추가
dabin-Hailey Jan 8, 2024
b08c3cc
design: 로그인 페이지 디자인 적용
dabin-Hailey Jan 9, 2024
4ad8ba6
move: Footer 폴더 위치 pages -> components 폴더 하위로 이동
dabin-Hailey Jan 9, 2024
d0c3805
design: Footer 디자인 적용
dabin-Hailey Jan 9, 2024
3ddef8e
design: 회원가입 페이지 디자인 적용
dabin-Hailey Jan 9, 2024
7c978dd
modify: 로그인 페이지 모든 px에 toRem 함수 적용
dabin-Hailey Jan 9, 2024
f3a8476
modify: 로그인 페이지 로고 텍스트 -> 이미지로 변경
dabin-Hailey Jan 9, 2024
6689bbd
design: 로그인&회원가입 페이지 배경색을 흰색으로 설정
dabin-Hailey Jan 11, 2024
85b762b
design: Footer 높이 지정
dabin-Hailey Jan 11, 2024
7d39e88
design: 로그인&회원가입 페이지에 푸터 추가
dabin-Hailey Jan 11, 2024
10dfe5c
modify: toRem함수 제거 및 px로 변경
dabin-Hailey Jan 11, 2024
40684ae
design: 회원가입 폼 내부 구분선 삭제 및 input간 간격 통일
dabin-Hailey Jan 11, 2024
2d44de5
design: input focus 상태에서 outline과 border 두께 변경 및 색상 통일
dabin-Hailey Jan 11, 2024
431a905
move: 로그인 타이틀과 입력폼 개별 컴포넌트로 분리
dabin-Hailey Jan 11, 2024
a502347
move: 회원가입 타이틀과 입력폼 개별 컴포넌트로 분리
dabin-Hailey Jan 11, 2024
3b877c2
Merge branch 'dev' of https://github.com/CoolPeace-yanolza/frontend i…
dabin-Hailey Jan 11, 2024
7f44fd0
modify: 로그인에서 사용하는 타입 분리
dabin-Hailey Jan 12, 2024
dc8caf3
modify: 회원가입에서 사용하는 타입 분리
dabin-Hailey Jan 12, 2024
7e2c85c
Merge branch 'dev' of https://github.com/CoolPeace-yanolza/frontend i…
dabin-Hailey Jan 12, 2024
eb00d46
remove: 사용하지 않는 useState 삭제
dabin-Hailey Jan 12, 2024
cc54b8c
remove: import React 삭제
dabin-Hailey Jan 12, 2024
1a9d264
modify: 가상 요소에 스타일 지정할 때 & 추가
dabin-Hailey Jan 12, 2024
0c678d9
modify: 컨벤션에 맞게 import 개행 추가 및 정렬
dabin-Hailey Jan 12, 2024
772c1b3
modify: 회원가입 버튼의 disable 상태를 관리하는 변수명 수정
dabin-Hailey Jan 12, 2024
e1a46e3
modify: 불필요한 flex-direction: row 삭제
dabin-Hailey Jan 12, 2024
5b8e095
modify: 회원가입 입력폼 height 계산에 필요한 값을 변수로 분리
dabin-Hailey Jan 12, 2024
a74ad1e
modify: LoginButton,SignUpButton -> Button으로 이름 통일
dabin-Hailey Jan 14, 2024
36fa8a5
modify: 푸터에 표시할 연도를 하드코딩에서 getFullYear() 메소드 사용으로 변경
dabin-Hailey Jan 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 114 additions & 0 deletions src/components/Login/LoginForm/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import styled from '@emotion/styled';

import { ButtonText, InputValidation } from '@/types/login';

const LoginForm = () => {
// HACK: 유효성 검사 기능 구현 후 유효성 메세지 노출 여부 결정
const isInvalid = true;

return (
<form>
<Inputs $isInvalid={isInvalid}>
<Input
type="email"
placeholder="이메일 입력"
/>
<Input
type="password"
placeholder="비밀번호 입력"
/>
</Inputs>
{isInvalid && (
<ValidationText>
<ValidationBoldText>아이디</ValidationBoldText>를 입력해 주세요
</ValidationText>
Comment on lines +22 to +24
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ValidationText 에 font-weight: 700;를 바로 주지 않고 따로 스타일 컴포넌트로 뺀 이유가 궁금합니다!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

피그마에서 자세히 살펴보니 유효성 메세지 중 아이디에 대해서만 bold 처리를 해두셨더라구요...! (착한 사람눈엔 보입니다..👀)

스크린샷 2024-01-12 오후 10 24 33

)}
<Buttons $isInvalid={isInvalid}>
<Button $text="login">로그인</Button>
<Button $text="signUp">회원가입</Button>
</Buttons>
</form>
);
};

export default LoginForm;

const Inputs = styled.div<InputValidation>`
margin-bottom: ${props => (props.$isInvalid ? '10px' : '65px')};

display: flex;
flex-direction: column;
gap: 19px;
`;

const Input = styled.input`
width: 524px;
height: 79px;

border-radius: 16px;
border: 2px solid #757676;
padding: 23px 20px;

display: flex;
align-items: center;

color: #1a2849;
font-size: 18px;
font-weight: 500;
line-height: 32px;

&::placeholder {
color: #979c9e;
font-size: 18px;
font-weight: 500;
line-height: 32px;
}

&:focus {
outline: 2px solid #1a2849;
border-color: #1a2849;
}
`;

const ValidationText = styled.p`
padding-left: 12px;

color: #da1e28;
font-size: 15px;
font-weight: 500;
line-height: 32px;
`;

const ValidationBoldText = styled.span`
font-weight: 700;
`;

const Buttons = styled.div<InputValidation>`
display: flex;
flex-direction: column;
gap: 13px;

${props => props.$isInvalid && 'margin-top: 23px'};
`;

const Button = styled.button<ButtonText>`
min-width: 524px;

border: none;
border-radius: 16px;
padding: 23px 0;

color: #fff;
font-size: 22px;
font-weight: 700;
line-height: 32px;

background: ${props =>
props.$text === 'login'
? '#1A2849'
: 'linear-gradient(91deg, #FF3478 1.39%, #FF83AD 98.63%)'};
Comment on lines +108 to +109
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요기만 왜 hex 코드가 소문자로 포맷팅이 안됐을까요? 그냥 궁금증..


&:hover {
cursor: pointer;
}
`;
39 changes: 39 additions & 0 deletions src/components/Login/LoginTitle/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import styled from '@emotion/styled';

import logo from '@assets/icons/ic-logo.svg';

const LoginTitle = () => {
return (
<TitleWrapper>
<LogoIcon
src={logo}
alt="사장님 비서ya"
/>
<Title>통합 로그인</Title>
</TitleWrapper>
);
};

export default LoginTitle;

const LogoIcon = styled.img`
width: 288px;
height: 60px;
`;

const TitleWrapper = styled.div`
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
gap: 11px;

text-align: center;
`;

const Title = styled.h1`
color: #1a2849;
font-size: 44.374px;
font-weight: 900;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

폰트 굵기 500이랑 700만 있는줄알았는데..! 300이랑 900도 추가해두겠습니다.

line-height: 51.769px;
`;
2 changes: 2 additions & 0 deletions src/components/Login/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default as LoginTitle } from './LoginTitle';
export { default as LoginForm } from './LoginForm';
178 changes: 178 additions & 0 deletions src/components/SignUp/SignUpForm/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
import styled from '@emotion/styled';

import { SignUpDisabledButton, SignUpInputValidation } from '@/types/signUp';

const SignUpForm = () => {
// TODO: react-hook-form 사용해서 유효성 검사 예정
const isInvalid = false;
const isEmailValidationVisible = false;

// 2가지 버튼 disabled 처리하기 위한 state
const isEmailValidationDisabled = true;
const isSubmitValidationDisabled = true;

return (
<Form>
<InputLabelWrapper>
<Label htmlFor="user_name">이름</Label>
<Input
type="text"
id="user_name"
placeholder="이름 입력"
required
/>
{isInvalid && (
<ValidationText $isInvalid={isInvalid}>
이름을 입력해 주세요.
</ValidationText>
)}
</InputLabelWrapper>
Comment on lines +16 to +29
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

향후 react-hook-form을 사용하게 되면 input 상태를 한번에 관리할 수 있을 것 같은데, 입력 받는 주제 단위로 컴포넌트를 Name, Email, Password로 분리해도 좋을 것 같다는 생각이 듭니다!

react-hook-form 사용하실 때 분리하여 작업하는게 불편하다면 무시하셔도 상관없습니다!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

우선 이번 PR 이후 로그인/회원가입 화면에서 사용할 공통 input 컴포넌트를 만들 예정이긴 했습니다!

제안주신 Name, Email, Password로 컴포넌트를 분리해서 만드는 것은 react-hook-form 사용하기 전에 다시 한번 고려해보겠습니다..!

<InputLabelWrapper>
<Label htmlFor="user_email">이메일</Label>
<EmailInputWrapper>
<EmailInput
type="email"
id="user_email"
placeholder="이메일 입력"
required
/>
<EmailValidationButton $isDisabled={isEmailValidationDisabled}>
중복확인
</EmailValidationButton>
</EmailInputWrapper>
{isEmailValidationVisible && (
<ValidationText $isInvalid={!isInvalid}>
사용 가능한 아이디입니다.
</ValidationText>
)}
</InputLabelWrapper>
<InputLabelWrapper>
<Label htmlFor="user_password">비밀번호</Label>
<Input
type="password"
id="user_password"
placeholder="8-20자, 영문/숫자/특수문자 조합"
required
/>
{isInvalid && (
<ValidationText $isInvalid={isInvalid}>
비밀번호 형식이 아닙니다.
</ValidationText>
)}
</InputLabelWrapper>
<InputLabelWrapper>
<Label htmlFor="user_password_confirm">비밀번호 확인</Label>
<Input
type="password"
id="user_password_confirm"
placeholder="다시 한번 입력해주세요."
required
/>
{isInvalid && (
<ValidationText $isInvalid={isInvalid}>
비밀번호가 일치하지 않습니다.
</ValidationText>
)}
</InputLabelWrapper>
<SubmitButton $isDisabled={isSubmitValidationDisabled}>
회원가입
</SubmitButton>
</Form>
);
};

export default SignUpForm;

const SubmitButton = styled.button<SignUpDisabledButton>`
min-width: 524px;
height: 78px;

border: none;
border-radius: 16px;
padding: 23px auto;

color: #fff;
font-size: 22px;
font-weight: 700;
line-height: 32px;

background: ${props => (props.$isDisabled ? '#C1C1C1' : '#1A2849')};

&:hover {
cursor: pointer;
}
`;

const Form = styled.form`
margin-top: 26px;

display: flex;
flex-direction: column;
gap: 23px;
`;

const InputLabelWrapper = styled.div`
display: flex;
flex-direction: column;
`;

const Label = styled.label`
margin-bottom: 10px;

color: #757676;
font-size: 18px;
font-weight: 700;
line-height: 32px;
`;

const Input = styled.input`
width: 524px;
height: 79px;

border-radius: 16px;
border: 2px solid #757676;
padding: 23px 20px;

display: flex;
align-items: center;

color: #1a2849;
font-size: 18px;
font-weight: 500;
line-height: 32px;

&::placeholder {
color: #979c9e;
font-size: 18px;
font-weight: 500;
line-height: 32px;
}

&:focus {
outline: 2px solid #1a2849;
border-color: #1a2849;
}
`;

const EmailInputWrapper = styled.div`
display: flex;
justify-content: space-between;
`;

const EmailInput = styled(Input)`
width: 358px;
`;

const EmailValidationButton = styled(SubmitButton)`
min-width: 152px;
`;

const ValidationText = styled.p<SignUpInputValidation>`
margin-top: 2px;
margin-left: 12px;

color: ${props => (props.$isInvalid ? '#DA1E28' : '#1a2849')};
font-size: 15px;
font-weight: 700;
line-height: 32px;
`;
36 changes: 36 additions & 0 deletions src/components/SignUp/SignUpTitle/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import styled from '@emotion/styled';

const SignUpTitle = () => {
return (
<TitleWrapper>
<Title>회원가입</Title>
<Description>
야놀자가 준비한 사장님 비서ya만의 혜택을 받아보세요.
</Description>
</TitleWrapper>
);
};

export default SignUpTitle;

const TitleWrapper = styled.div`
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: flex-start;
`;

const Title = styled.h1`
color: #202325;
font-size: 26px;
font-weight: 700;
line-height: 31px;
letter-spacing: -0.78px;
`;

const Description = styled.p`
color: #979c9e;
font-size: 18px;
font-weight: 500;
line-height: 32px;
`;
2 changes: 2 additions & 0 deletions src/components/SignUp/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default as SignUpForm } from './SignUpForm';
export { default as SignUpTitle } from './SignUpTitle';
Loading