Skip to content

Commit

Permalink
refactor: depromeet#11 Remove SocialLoginButtonDependency
Browse files Browse the repository at this point in the history
  • Loading branch information
sean2337 committed Jul 7, 2024
1 parent f86a9ca commit 2f3eecc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/component/button/SocialLoginButton.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { css } from "@emotion/react";
import { loginBtnType } from "@/types/loginType";
import { loginTypeProvider, loginBtnType } from "@/types/loginType";
import LoginSpriteSvg from "../Img/LoginSpriteSvg";

// FIXME : 버튼 색 수정 필요
const backgroundColors = {
const backgroundColors: Record<keyof typeof loginTypeProvider, string> = {
kakao: "#ffe400",
google: "#FFFFFF",
apple: "red",
};

const SocialLoginButton = ({ type, handler }: loginBtnType) => {
Expand Down Expand Up @@ -34,7 +35,7 @@ const SocialLoginButton = ({ type, handler }: loginBtnType) => {
>
<LoginSpriteSvg type={type} />
</div>
{type === "kakao" ? "카카오로" : "구글"} 로그인
{loginTypeProvider[type]} 로그인
</button>
);
};
Expand Down
12 changes: 10 additions & 2 deletions src/types/loginType/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
export const loginTypeProvider = {
apple: "애플",
google: "구글",
kakao: "카카오",
};

type loginProvider = keyof typeof loginTypeProvider;

export type loginType = {
type: "google" | "kakao";
type: loginProvider;
};

export type loginBtnType = {
type: "google" | "kakao";
type: loginProvider;
handler: () => void;
};

0 comments on commit 2f3eecc

Please sign in to comment.