Skip to content

Commit

Permalink
refactor: 채팅 버튼 color 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
gchoi96 committed Dec 13, 2022
1 parent 78f528b commit 97f1810
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion client/src/components/commons/ChatButton/ChatButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const ChatButton = () => {
const { id } = useParams();
const navigate = useNavigate();
return (
<Button backgroundColor={COLOR.ORANGE} onClick={() => navigate(`/recruit/${id}/chat`)}>
<Button backgroundColor={COLOR.CHAT_BUTTON} onClick={() => navigate(`/recruit/${id}/chat`)}>
채팅
</Button>
);
Expand Down
7 changes: 5 additions & 2 deletions client/src/hooks/useAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ import { useEffect } from "react";
import { useNavigate } from "react-router-dom";
import { useRecoilValue } from "recoil";

const useAuth = () => {
const useAuth = (withAuth = true) => {
const userInfo = useRecoilValue(userState);
const navigate = useNavigate();
useEffect(() => {
if (!userInfo.accessToken) {
if (withAuth && !userInfo.accessToken) {
alert("로그인이 필요한 페이지입니다");
navigate("/login");
}
if (!withAuth && userInfo.accessToken) {
navigate(-1);
}
}, []);
return userInfo;
};
Expand Down
3 changes: 2 additions & 1 deletion client/src/pages/Login/Login.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from "react";
import Header from "#components/Header/Header";
import { LogoWrapper } from "./Login.styles";
import Navigator from "#components/Navigator/Navigator";
import LoginForm from "#components/LoginForm/LoginForm";
import useAuth from "#hooks/useAuth";

const Login = () => {
useAuth(false);
return (
<>
<Header text="로그인" />
Expand Down
2 changes: 2 additions & 0 deletions client/src/pages/SignUp/SignUp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import { Logo } from "./SignUp.styles";

import SignUpForm from "#components/SignUpForm/SignUpForm";
import Navigator from "#components/Navigator/Navigator";
import useAuth from "#hooks/useAuth";

const SignUp = () => {
useAuth(false);
return (
<>
<Header text="회원가입"></Header>
Expand Down
1 change: 1 addition & 0 deletions client/src/styles/color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ export enum COLOR {
BABY_BLUE = "#ACB7C7",
ORANGE = "#FFB800",
F1F4F7 = "#F1F4F7",
CHAT_BUTTON = "#4A668B",
}

0 comments on commit 97f1810

Please sign in to comment.