-
Notifications
You must be signed in to change notification settings - Fork 1
[Design & Refactor] OAuth 통합 레이아웃, 로그인 홈 버튼 UI #164
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
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| import React, { Suspense, useEffect, useState } from 'react'; | ||
| import Image from 'next/image'; | ||
| import styled from 'styled-components'; | ||
| import { useSearchParams } from 'next/navigation'; | ||
| import { setLetterUrl } from '@/utils/storage'; | ||
| import Loader, { LoaderContainer } from '../common/Loader'; | ||
|
|
||
| const SocialGoogle = () => { | ||
| const searchParams = useSearchParams(); | ||
| const url = searchParams.get('url'); | ||
| const REST_API_KEY = process.env.NEXT_PUBLIC_REST_API_KEY; | ||
| const GOOGLE_URL = '/login/google'; | ||
| const [absoluteUrl, setabsoluteUrl] = useState(''); | ||
|
|
||
| useEffect(() => { | ||
| if (typeof window !== 'undefined') { | ||
| setabsoluteUrl( | ||
| window.location.protocol + '//' + window.location.host + '/login/kakao' | ||
| ); | ||
| } | ||
| }, []); | ||
|
|
||
| const handleLogin = () => { | ||
| //이때 localStorage에 저장된 accessToken이 만료되었는지 확인해야함. | ||
| // if (accessToken) { | ||
| // if (url) { | ||
| // router.push(`/verify?url=${url}`); | ||
| // } else { | ||
| // router.push("/"); | ||
| // } | ||
| // setAccessToken(accessToken); | ||
| // } else { | ||
| //받은 편지를 통해 들어올 경우 url를 저장한다. | ||
| if (url) { | ||
| setLetterUrl(url); | ||
| } | ||
| window.location.href = GOOGLE_URL; | ||
| }; | ||
|
|
||
| return ( | ||
| <SocialLoginBox onClick={handleLogin}> | ||
| <StyledImage | ||
| src="/assets/icons/ic_google.svg" | ||
| width={33} | ||
| height={33} | ||
| alt="google" | ||
| /> | ||
| </SocialLoginBox> | ||
| ); | ||
| }; | ||
|
|
||
| export default function SocialGooglePaging() { | ||
| return ( | ||
| <Suspense | ||
| fallback={ | ||
| <LoaderContainer> | ||
| <Loader /> | ||
| </LoaderContainer> | ||
| } | ||
| > | ||
| <SocialGoogle /> | ||
| </Suspense> | ||
| ); | ||
| } | ||
|
|
||
| const SocialLoginBox = styled.div` | ||
| display: flex; | ||
| box-sizing: border-box; | ||
| width: 100%; | ||
| cursor: pointer; | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| `; | ||
|
|
||
| const StyledImage = styled(Image)` | ||
| width: 100%; | ||
| height: 100%; | ||
| padding: 0 16px; | ||
| object-fit: contain; | ||
| `; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
혹시 여기서 각각의 버튼을 별개의 컴포넌트로 정의해야하는 이유가 있을까? constant로 type(NAVER, GOOGLE, KAKAO), svg, backgroundColor 등을 정의해서 map으로 불러와도 되지 않나 싶어서! 로직도 동일해서 공통의 onClick 함수로 사용해도 좋을 것 같아.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오호...그게 더 코드 간결성에는 좋겠다..!! 그 생각을 못했네 좋은 의견이야 👍