diff --git a/public/assets/kakao_login_medium_wide.png b/public/assets/kakao_login_medium_wide.png
new file mode 100644
index 00000000..c882acc7
Binary files /dev/null and b/public/assets/kakao_login_medium_wide.png differ
diff --git a/src/app/login/page.tsx b/src/app/login/page.tsx
index ce9fc44b..9dd842a0 100644
--- a/src/app/login/page.tsx
+++ b/src/app/login/page.tsx
@@ -8,6 +8,7 @@ import { useForm } from 'react-hook-form';
import classNames from 'classnames/bind';
import Link from 'next/link';
+import KakaoLoginButton from '@components/home/kakao-login-button/KakaoLoginButton';
import VALIDATION_MESSAGE_MAP from '@constants/validationMessage';
import { ISignIn } from '@remote/api/types/auth';
import useLogin from '@remote/queries/auth/useLogin';
@@ -37,7 +38,7 @@ function LoginPage() {
/* -- redux test -- */
const userId = useAppSelector((state) => { return state.user.id; });
- console.log(userId);
+ // console.log(userId);
if (isSuccess) {
console.log(userId);
@@ -82,6 +83,8 @@ function LoginPage() {
비밀번호 찾기
+
+
>
);
diff --git a/src/app/my-page/page.tsx b/src/app/my-page/page.tsx
index 6b0c9a7a..87efc03d 100644
--- a/src/app/my-page/page.tsx
+++ b/src/app/my-page/page.tsx
@@ -3,6 +3,7 @@
import { useEffect, useState } from 'react';
import { useCookies } from 'react-cookie';
+import { useQueryClient } from '@tanstack/react-query';
import classNames from 'classnames/bind';
import Link from 'next/link';
import { useRouter } from 'next/navigation';
@@ -24,6 +25,7 @@ const cx = classNames.bind(styles);
function MyProfilePage() {
const router = useRouter();
const dispatch = useAppDispatch();
+ const query = useQueryClient();
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const [cookies, removeCookie] = useCookies(['token']);
@@ -41,6 +43,7 @@ function MyProfilePage() {
// TODO: 먼저 로그아웃 모달이 뜨도록 할지 논의필요
dispatch(clearUserId());
removeCookie('token', { path: '/' });
+ query.clear();
router.push('/');
};
diff --git a/src/components/home/kakao-login-button/KakaoLoginButton.module.scss b/src/components/home/kakao-login-button/KakaoLoginButton.module.scss
new file mode 100644
index 00000000..d21003ed
--- /dev/null
+++ b/src/components/home/kakao-login-button/KakaoLoginButton.module.scss
@@ -0,0 +1,6 @@
+.kakaoLoginWrapper {
+ display: block;
+ height: 45px;
+ margin: 0 auto;
+ cursor: pointer;
+}
diff --git a/src/components/home/kakao-login-button/KakaoLoginButton.tsx b/src/components/home/kakao-login-button/KakaoLoginButton.tsx
new file mode 100644
index 00000000..d1d12122
--- /dev/null
+++ b/src/components/home/kakao-login-button/KakaoLoginButton.tsx
@@ -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 (
+ <>
+
+
+ >
+ );
+}
+
+export default KakaoLoginButton;
diff --git a/src/components/shared/header/headerItems/RightIcon.tsx b/src/components/shared/header/headerItems/RightIcon.tsx
index 6297cf68..e2127058 100644
--- a/src/components/shared/header/headerItems/RightIcon.tsx
+++ b/src/components/shared/header/headerItems/RightIcon.tsx
@@ -8,7 +8,7 @@ import FilledHeart from '@components/icons/FilledHeart';
import Filter from '@components/icons/Filter';
import Heart from '@components/icons/Heart';
import Search from '@components/icons/Search';
-import Share from '@components/icons/Share';
+import KakaoShareButton from '@shared/kakao-share-button/KakaoShareButton';
import { RightIconProps } from '../types/headerType';
@@ -50,7 +50,7 @@ function RightIcon({
: }
-
+
);
diff --git a/src/components/shared/kakao-script/KakaoLoginScript.tsx b/src/components/shared/kakao-script/KakaoLoginScript.tsx
new file mode 100644
index 00000000..15159d89
--- /dev/null
+++ b/src/components/shared/kakao-script/KakaoLoginScript.tsx
@@ -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 (
+
+ );
+}
+
+export default KakaoLoginScript;
diff --git a/src/components/shared/kakao-share-button/KakaoShareButton.tsx b/src/components/shared/kakao-share-button/KakaoShareButton.tsx
new file mode 100644
index 00000000..22fe9cbe
--- /dev/null
+++ b/src/components/shared/kakao-share-button/KakaoShareButton.tsx
@@ -0,0 +1,24 @@
+/* eslint-disable jsx-a11y/control-has-associated-label */
+
+import Script from 'next/script';
+
+import Share from '@components/icons/Share';
+import useKakaoShare from '@hooks/useKakaoShare';
+
+function KakaoShareButton() {
+ const containerId = useKakaoShare('#kakao-link-btn', process.env.NEXT_PUBLIC_KAKAO_APP_JS_KEY!);
+
+ return (
+ <>
+
+
+ >
+ );
+}
+export default KakaoShareButton;
diff --git a/src/components/shared/map/KakaoMap.tsx b/src/components/shared/map/KakaoMap.tsx
index 40042d40..457b01a7 100644
--- a/src/components/shared/map/KakaoMap.tsx
+++ b/src/components/shared/map/KakaoMap.tsx
@@ -7,7 +7,7 @@
'use client';
-import { useEffect, useState } from 'react';
+import { useState } from 'react';
import Script from 'next/script';
diff --git a/src/hooks/useKakaoShare.ts b/src/hooks/useKakaoShare.ts
new file mode 100644
index 00000000..8caf4da5
--- /dev/null
+++ b/src/hooks/useKakaoShare.ts
@@ -0,0 +1,73 @@
+/* eslint-disable @typescript-eslint/no-unsafe-assignment */
+/* eslint-disable @typescript-eslint/no-explicit-any */
+/* eslint-disable @typescript-eslint/no-unsafe-call */
+/* eslint-disable @typescript-eslint/no-unsafe-member-access */
+import { useCallback, useEffect } from 'react';
+
+declare global {
+ interface Window {
+ Kakao: any
+ }
+}
+
+function useKakaoShare(containerId: string, key: string) {
+ const createShareButton = useCallback(() => {
+ // kakao sdk script이 정상적으로 불러와졌으면 window.Kakao로 접근이 가능합니다
+ if (window.Kakao) {
+ const kakao = window.Kakao;
+ // 중복 initialization 방지
+ if (!kakao.isInitialized()) {
+ // 두번째 step 에서 가져온 javascript key 를 이용하여 initialize
+ kakao.init(key);
+ }
+ kakao.Share.createDefaultButton({
+ // Render 부분 id=kakao-link-btn 을 찾아 그부분에 렌더링을 합니다
+ container: containerId,
+ objectType: 'feed',
+ content: {
+ title: 'Washfit',
+ description: '안전한 세차용품 정보 제공 플랫폼',
+ imageUrl:
+ 'https://tago.kr/images/sub/TG300-D02_img01.png',
+ link: {
+ webUrl: 'https://dev.washfit.site/',
+ mobileWebUrl: 'https://dev.washfit.site/',
+ },
+ },
+ social: {
+ likeCount: 77,
+ commentCount: 55,
+ sharedCount: 333,
+ },
+ buttons: [
+ // 카카오톡 웹에서 보기
+ {
+ title: '웹으로 보기',
+ link: {
+ mobileWebUrl: 'https://dev.washfit.site/',
+ webUrl: 'https://dev.washfit.site/',
+ },
+ },
+ // 카카오톡 모바일에서 보기
+ {
+ title: '앱으로 보기',
+ link: {
+ mobileWebUrl: 'https://dev.washfit.site/',
+ webUrl: 'https://dev.washfit.site/',
+ },
+ },
+ ],
+ });
+ }
+ }, [containerId, key]);
+
+ useEffect(() => {
+ createShareButton();
+ }, [createShareButton]);
+
+ // #kakao-link-btn과 같은 id에서 '#'제거 과정
+ const id = containerId.substring(1);
+ return id;
+}
+
+export default useKakaoShare;