Skip to content
This repository has been archived by the owner on Jun 15, 2024. It is now read-only.

Commit

Permalink
Merge pull request #104 from Stocodi/fix/auth
Browse files Browse the repository at this point in the history
Fix: 로그인 / 회원가입 페이지 요구사항 반영
  • Loading branch information
toothlessdev authored Jan 28, 2024
2 parents e81a428 + e778d06 commit 22a9bdb
Show file tree
Hide file tree
Showing 12 changed files with 251 additions and 85 deletions.
4 changes: 1 addition & 3 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ export default function App() {

<Route path="/auth" element={<AuthLayout />}>
<Route path="signin" element={<SigninPage />} />
<Route path="signup/step1" element={<SignupPage.One />} />
<Route path="signup/step2" element={<SignupPage.Two />} />
<Route path="signup/step3" element={<SignupPage.Three />} />
<Route path="signup" element={<SignupPage />} />
</Route>

<Route path="/test" element={<TestLayout />}>
Expand Down
3 changes: 2 additions & 1 deletion src/api/Authentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export interface ILoginResponseBody {
};
}

export interface ISignupRequestBody extends Omit<IUserSignup, "interest_categories" | "isEmailVerified" | "isNickNameVerified"> {
export interface ISignupRequestBody
extends Omit<IUserSignup, "interest_categories" | "isEmailVerified" | "isPasswordVerified" | "isNickNameVerified"> {
interest_categories: string[];
}

Expand Down
3 changes: 3 additions & 0 deletions src/components/auth-page/CategoryGrid.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
.category_grid_container {
margin: 0px auto;

max-height: 80%;
overflow: scroll;

display: grid;
grid-template-rows: repeat(5, 1fr);
grid-template-columns: repeat(5, 1fr);
Expand Down
8 changes: 8 additions & 0 deletions src/interfaces/forms/Input.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@
p {
margin: 5px 0px;
font-weight: bold;

display: flex;
justify-content: space-between;

span:last-child {
font-weight: normal;
color: red;
}
}
}

Expand Down
32 changes: 30 additions & 2 deletions src/interfaces/forms/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,18 @@ export interface IInput {
rest?: unknown;
placeholder?: string;
disabled?: boolean;
inlineStyle?: React.CSSProperties;
onChange?: React.ChangeEventHandler<HTMLInputElement>;
}

export interface IInputContainer extends IInput {
label: string;
}

export interface IInputVerifyContainer extends IInputContainer {
verifyLabel: string;
}

export interface ITextArea {
width?: string;
height?: string;
Expand All @@ -33,8 +38,17 @@ export interface IInputButtonContainer extends IInputContainer {
onClick: MouseEventHandler<HTMLButtonElement>;
}

export const Input = forwardRef<HTMLInputElement, IInput>(({ width, height, onChange, disabled, ...rest }, ref) => {
return <input ref={ref} disabled={disabled} className={styles.input} style={{ width: width, height: height }} onChange={onChange} {...rest} />;
export const Input = forwardRef<HTMLInputElement, IInput>(({ width, height, onChange, disabled, inlineStyle, ...rest }, ref) => {
return (
<input
ref={ref}
disabled={disabled}
className={styles.input}
style={{ ...inlineStyle, width: width, height: height }}
onChange={onChange}
{...rest}
/>
);
});

export const InputContainer = forwardRef<HTMLInputElement, IInputContainer>(({ width, height, label, ...rest }, ref) => {
Expand All @@ -46,6 +60,20 @@ export const InputContainer = forwardRef<HTMLInputElement, IInputContainer>(({ w
);
});

export const InputVerificationContainer = forwardRef<HTMLInputElement, IInputVerifyContainer>(
({ width, height, label, verifyLabel, ...rest }, ref) => {
return (
<div className={styles.input_container} style={{ width: width }}>
<p>
<span>{label}</span>
<span>{verifyLabel}</span>
</p>
<Input ref={ref} width="inherit" height={height} {...rest} />
</div>
);
},
);

export const InputButtonContainer = forwardRef<HTMLInputElement, IInputButtonContainer>(
({ width, height, label, btnWidth, btnLabel, onClick, ...rest }, ref) => {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/layouts/AuthLayout.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@
@include mobile {
.auth_page_wrapper {
border-radius: 0px;
padding: $p-mobile;
padding: 20px;
}
}
10 changes: 8 additions & 2 deletions src/pages/auth-page/SigninPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@ import { InputContainer } from "../../interfaces/forms/Input";
import { Title } from "../../components/auth-page/Title";

import { handleLogin } from "../../api/Authentication";
import { Dispatch } from "@reduxjs/toolkit";
import { useDispatch } from "react-redux";
import { UserInterfaceActions } from "../../store/user-interface-slice";

// import { SocialLoginProviders } from "../../constants/SocialLogin";

export default function SigninPage() {
const dispatch: Dispatch = useDispatch();

const naviagte = useNavigate();
const idRef = useRef<HTMLInputElement>(null);
const pwRef = useRef<HTMLInputElement>(null);
Expand All @@ -20,6 +25,7 @@ export default function SigninPage() {
// 로그인 요청 & 쿠키 저장
try {
await handleLogin(idRef.current?.value as string, pwRef.current?.value as string);
dispatch(UserInterfaceActions.closeNav());
naviagte("/");
} catch (err) {
alert("아이디 혹은 비밀번호가 일치하지 않습니다");
Expand All @@ -35,7 +41,7 @@ export default function SigninPage() {
<Title title="로그인" subtitle="로그인 후 서비스를 이용해보세요"></Title>

<div className={styles.signin_container}>
<InputContainer ref={idRef} type="text" width="100%" height="50px" label="아이디"></InputContainer>
<InputContainer ref={idRef} type="text" width="100%" height="50px" label="이메일"></InputContainer>
<InputContainer ref={pwRef} type="password" width="100%" height="50px" label="비밀번호"></InputContainer>
</div>

Expand All @@ -54,7 +60,7 @@ export default function SigninPage() {

<div className={styles.signup_link}>
아직 계정이 없으신가요?
<Link to="/auth/signup/step1">회원가입</Link>
<Link to="/auth/signup">회원가입</Link>
</div>
</div>

Expand Down
44 changes: 26 additions & 18 deletions src/pages/auth-page/SignupPage.module.scss
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
@import "@/styles/utils.scss";

.signin_page {
width: 100%;
height: 100%;
}
// .signin_page {
// width: 100%;
// height: 100%;
// }

.signin_background {
@include place-center;
position: absolute;
top: 0;
right: 0;
width: 40%;
height: 100%;
z-index: -1;
// .signin_background {
// @include place-center;
// position: absolute;
// top: 0;
// right: 0;
// width: 40%;
// height: 100%;
// z-index: -1;

img {
width: 100%;
height: 100%;
object-fit: cover;
}
}
// img {
// width: 100%;
// height: 100%;
// object-fit: cover;
// }
// }

.btn_group {
display: flex;
Expand All @@ -28,3 +28,11 @@
width: min(100%, 700px);
margin: 0px auto;
}

.input_wrapper {
display: flex;
flex-direction: column;
gap: 10px;

width: 100%;
}
Loading

0 comments on commit 22a9bdb

Please sign in to comment.