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

로그인(Oauth) 페이지 레이아웃 완성 #55

Merged
merged 2 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 20 additions & 0 deletions src/pages/login/Login.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { AlignCenter } from '../../style/LayOut';
import { FlexContainer, LogoImageSection, SocialLoginLink } from './styles';

export default function Login() {
const kakaoURL = `https://kauth.kakao.com/oauth/authorize?client_id=${
import.meta.env.VITE_KAKAO_REST_API_KEY
}&redirect_uri=${import.meta.env.VITE_KAKAO_REDIRECT_URL}&response_type=code`;
return (
<>
Comment on lines +5 to +9
Copy link
Collaborator

Choose a reason for hiding this comment

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

oauth할 때 형식이 다 동일해서 util함수로 만들어서 관리하면 좋을 것 같습니다.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

넵 컴포넌트에 저런식으로 나열해놓는건 별로인거같긴 합니다 개인적으로는 api key와 redirect url 모두 고정적인 자원이니 카카오 url 전체를 그냥 env로 관리해도 괜찮을 것 같습니다

<AlignCenter>
<FlexContainer>
<LogoImageSection />
<SocialLoginLink to={kakaoURL}>카카오</SocialLoginLink>
<SocialLoginLink to="">구글</SocialLoginLink>
<SocialLoginLink to="">깃허브</SocialLoginLink>
</FlexContainer>
</AlignCenter>
</>
);
}
26 changes: 26 additions & 0 deletions src/pages/login/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Link } from 'react-router-dom';
import styled from 'styled-components';
export const FlexContainer = styled.section`
width: 1280px;
display: flex;
flex-direction: column;
align-items: center;
`;
export const LogoImageSection = styled.section`
margin: 163px 0px 70px 0px;
width: 372px;
height: 82px;
border: 2px dashed #f00;
background: #efeff0;
`;
export const SocialLoginLink = styled(Link)`
display: block;
margin-bottom: 45px;
width: 412px;
height: 50px;
color: black;
text-decoration: none; // 밑줄 없애기
border-radius: 4px;
border: 2px solid #000;
background: #fff;
`;
2 changes: 2 additions & 0 deletions src/route/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Ranking from '../pages/Ranking/Ranking';
import Quiz from '../pages/Quiz/Quiz';
import Admin from '../admin/Admin';
import CreateQuiz from '../admin/CreateQuiz';
import Login from '../pages/login/login';
export default function Router() {
return (
<>
Expand All @@ -14,6 +15,7 @@ export default function Router() {
<Route path="/quest" element={<Quest />}></Route>
<Route path="/ranking" element={<Ranking />}></Route>
<Route path="/quiz/:section/:part" element={<Quiz />}></Route>
<Route path="/login" element={<Login />}></Route>
{/*어드민 페이지 부분 문제조회/추가 이외에 규모 확장 시 레포 분리 */}
<Route path="/admin" element={<Admin />} />
<Route path="/admin/create-quiz" element={<CreateQuiz />}></Route>
Copy link
Collaborator

Choose a reason for hiding this comment

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

이 부분 아까 같이 말씀 나눠봤지만 대문자든 소문자든 index든 해서 맞춰주면 좋을 것 같네용

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

확인했습니다 폴더명이 Quiz, login등등으로 코드 컨밴션을 정할때 같이 정했어야 했는데 이런 부분을 체크하지 못한 것 같습니다. 이 부분은 따로 노션에 정리 후 이슈 생성해서 고치도록 하겠습니다

Expand Down