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

[7주차] TherapEase 과제 제출합니다. #7

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
7f0f935
init project
flowersayo Jun 13, 2023
2c4a0c5
docs: 커밋 템플릿 생성
Gaeun-Kwon Jun 13, 2023
797d157
feat: 프로젝트 초기 세팅
Gaeun-Kwon Jun 13, 2023
da58cf2
docs: 이슈 템플릿 생성
Gaeun-Kwon Jun 13, 2023
6cb4bfe
feat: 라우팅 수정
Gaeun-Kwon Jun 13, 2023
a954685
Merge branch 'main' of https://github.com/TherapEase-CEOS/react-vote-…
Gaeun-Kwon Jun 13, 2023
0423a52
fix : add React dependency
flowersayo Jun 16, 2023
ca4c396
feat: Header 컴포넌트 생성 및 라우팅 변경 (#6)
Gaeun-Kwon Jun 18, 2023
858cb99
feat: Layout 사이즈 설정
Gaeun-Kwon Jun 18, 2023
714246d
feat: 메인페이지 레이아웃 (#8)
flowersayo Jun 18, 2023
75708ab
fix: 기존 컴포넌트 조정
Gaeun-Kwon Jun 18, 2023
09ff328
feat: part main page ui
Gaeun-Kwon Jun 18, 2023
1c6ffcf
feat: part vote page ui
Gaeun-Kwon Jun 18, 2023
e5f6362
feat: part result page ui
Gaeun-Kwon Jun 18, 2023
df20dd3
chore: add eslintrc.json
Gaeun-Kwon Jun 20, 2023
32463bb
feat: demo main page layout
flowersayo Jun 18, 2023
5eb0b28
feat: demo vote page ui
flowersayo Jun 18, 2023
0e3997e
feat: demo result page ui
flowersayo Jun 18, 2023
17094c8
fix: 기존 컴포넌트 조정
Gaeun-Kwon Jun 18, 2023
0a857ab
feat: part main page ui
Gaeun-Kwon Jun 18, 2023
fa1dd4d
feat: part vote page ui
Gaeun-Kwon Jun 18, 2023
13a5b2d
feat: part result page ui
Gaeun-Kwon Jun 18, 2023
a76f3ed
Merge branch 'feature/#3-part-pages-ui' of https://github.com/TherapE…
Gaeun-Kwon Jun 21, 2023
0829037
feat: 데모페이지 UI (#11)
flowersayo Jun 24, 2023
c3c154c
Revert "feat: 데모페이지 UI (#11)" (#13)
flowersayo Jun 25, 2023
b287a55
Merge branch 'develop' into release
flowersayo Jun 25, 2023
2eb5b43
feat: 데모페이지 UI (#11)
flowersayo Jun 24, 2023
621ee1a
add: create axios modules
flowersayo Jun 26, 2023
79a5e42
add : create db.json for json API Mock Server
flowersayo Jun 26, 2023
525af81
add missing commit (a76f3ed)
flowersayo Jun 26, 2023
61ffe54
add: add interface
flowersayo Jun 26, 2023
8ccdf49
chore : move interface.tsx
flowersayo Jun 26, 2023
02c7dd4
feat: 회원가입, 로그인 화면 UI 구현 (#12)
Gaeun-Kwon Jun 26, 2023
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
16 changes: 16 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"axios": "^1.4.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.45.0",
"react-icons": "^4.9.0",
"react-router-dom": "^6.12.1",
"react-scripts": "5.0.1",
Expand Down
18 changes: 18 additions & 0 deletions src/constants/errorMesssages.ts
Copy link

Choose a reason for hiding this comment

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

error 메시지를 정리해놓고 사용하니까 깔끔하네요!!

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export const SIGNUP_LOGIN_ERROR_MESSAGES = {
userName: '*이름을 입력해주세요.',
userId: '*아이디를 입력해주세요.',

pw: [
'*비밀번호를 입력해주세요.',
'*비밀번호: 8~16자 영문 대소문자, 숫자를 입력해주세요.',
],

pwCheck: [
'*비밀번호를 한 번 더 입력해주세요.',
'*비밀번호가 일치하지 않습니다.',
],

email: ['*이메일을 입력해주세요.', '*이메일 형식을 입력해주세요.'],
teamName: '*팀을 선택해주세요.',
partName: '*파트를 선택해주세요.',
};
12 changes: 12 additions & 0 deletions src/constants/selectOptions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export const TEAM_OPTIONS = [
{ label: 'TherapEase', value: 'TherapEase' },
{ label: 'RePick', value: 'RePick' },
{ label: 'BariBari', value: 'BariBari' },
{ label: 'Hooking', value: 'Hooking' },
{ label: 'Dansupport', value: 'Dansupport' },
];

export const PART_OPTIONS = [
{ label: 'FRONTEND', value: 'fe' },
{ label: 'BACKEND', value: 'be' },
];
105 changes: 103 additions & 2 deletions src/pages/Login/LoginPage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,107 @@
import React from 'react';
import React, { useEffect } from 'react';
import { useForm, SubmitHandler } from 'react-hook-form';

import styled from '@emotion/styled';

import { Headline } from '../../styles/Typography';
import { Button, TextField } from '@mui/material';

import { REGEX } from '../../utils/regex';

import { SIGNUP_LOGIN_ERROR_MESSAGES } from '../../constants/errorMesssages';

interface loginFormValues {
userId: string;
userPassword: string;
}

const LoginPage = () => {
return <div>로그인 페이지</div>;
const {
register,
handleSubmit,
formState: { errors },
} = useForm<loginFormValues>();

Choose a reason for hiding this comment

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

form 관리할 때 쓸 수 있는 useForm이라는 리액트 훅이 있다는 건 처음 알았네요..! 배워갑니다 ㅎㅎ
참고자료

const onSubmit: SubmitHandler<loginFormValues> = (data) => {
// TODO - api 연동
console.log(data);
};

return (
<Wrapper>
<Headline
color="#ffff"
style={{ width: 'calc(30% + 8rem)', textAlign: 'start' }}
>
로그인
</Headline>
<FormWrapper onSubmit={handleSubmit(onSubmit)}>
<TextField
id="userId"
label="아이디"
helperText={errors?.userId?.message}
variant="outlined"
size="small"
fullWidth={true}
{...register('userId', {
required: {
value: true,
message: SIGNUP_LOGIN_ERROR_MESSAGES.userId,
},
})}
/>
<TextField
id="userPassword"
label="비밀번호"
type="password"
helperText={errors?.userPassword?.message}
variant="outlined"
size="small"
fullWidth={true}
{...register('userPassword', {
required: {
value: true,
message: SIGNUP_LOGIN_ERROR_MESSAGES.pw[0],
},
pattern: {
value: REGEX.password,
message: SIGNUP_LOGIN_ERROR_MESSAGES.pw[1],
},
})}
/>
<Button
type="submit"
variant="contained"
sx={{ width: '10rem', marginTop: '1rem' }}
>
로그인
</Button>
</FormWrapper>
</Wrapper>
);
};

const Wrapper = styled.div`
width: 100vw;
height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background-color: var(--ceos-blue-color);
`;

const FormWrapper = styled.form`
width: 30%;
// height: 80vh;
display: flex;
flex-direction: column;
align-items: center;
padding: 5rem 4rem 3rem 4rem;
background-color: #ffff;
border-radius: 1.25rem;
border: 3px solid #fff;
gap: 1rem;
`;

export default LoginPage;
Loading