-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #174 from Kernel360/page-login-kakao-ui
페이지 기능: 로그인 페이지 카카오 UI 제작
- Loading branch information
Showing
6 changed files
with
71 additions
and
2 deletions.
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.
This file contains 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
6 changes: 6 additions & 0 deletions
6
src/components/home/kakao-login-button/KakaoLoginButton.module.scss
This file contains 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,6 @@ | ||
.kakaoLoginWrapper { | ||
display: block; | ||
height: 45px; | ||
margin: 0 auto; | ||
cursor: pointer; | ||
} |
30 changes: 30 additions & 0 deletions
30
src/components/home/kakao-login-button/KakaoLoginButton.tsx
This file contains 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,30 @@ | ||
/* eslint-disable @typescript-eslint/no-unsafe-call */ | ||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ | ||
import classNames from 'classnames/bind'; | ||
import Image from 'next/image'; | ||
|
||
import KakaoLoginScript from '@shared/kakao-script/KakaoLoginScript'; | ||
|
||
import styles from './KakaoLoginButton.module.scss'; | ||
|
||
const cx = classNames.bind(styles); | ||
|
||
function KakaoLoginButton() { | ||
// TODO: 인가코드를 이용해서 백엔드에 api 요청하기 | ||
const handleLoginKakao = () => { | ||
window.Kakao.Auth.authorize({ | ||
redirectUri: process.env.NEXT_PUBLIC_KAKAO_REDIRECT_URI, | ||
}); | ||
}; | ||
|
||
return ( | ||
<> | ||
<button className={cx('kakaoLoginWrapper')} type="button" onClick={handleLoginKakao}> | ||
<Image src="/assets/kakao_login_medium_wide.png" alt="카카오 로그인 버튼" width={300} height={45} /> | ||
</button> | ||
<KakaoLoginScript /> | ||
</> | ||
); | ||
} | ||
|
||
export default KakaoLoginButton; |
This file contains 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,30 @@ | ||
/* eslint-disable @typescript-eslint/no-unsafe-call */ | ||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
|
||
'use client'; | ||
|
||
import Script from 'next/script'; | ||
|
||
declare global { | ||
interface Window { | ||
Kakao: any | ||
} | ||
} | ||
|
||
function KakaoLoginScript() { | ||
const onLoad = () => { | ||
window.Kakao.init(process.env.NEXT_PUBLIC_KAKAO_APP_JS_KEY); | ||
}; | ||
|
||
return ( | ||
<Script | ||
strategy="afterInteractive" | ||
type="text/javascript" | ||
src={`https://t1.kakaocdn.net/kakao_js_sdk/${process.env.NEXT_PUBLIC_KAKAO_LOGIN_VERSION}/kakao.min.js`} | ||
onReady={onLoad} | ||
/> | ||
); | ||
} | ||
|
||
export default KakaoLoginScript; |
This file contains 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