Skip to content

Commit

Permalink
🎉 구글, 카카오 로그인 버튼 생성
Browse files Browse the repository at this point in the history
  • Loading branch information
oaoong committed Oct 30, 2023
1 parent 969c403 commit 0d86660
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
NEXT_PUBLIC_API_MOCKING=enabled # or disabled
NEXT_PUBLIC_API_MOCKING=enabled # or disabled
CHROMATIC_TOKEN=your-token
Binary file added public/images/google.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/kakao.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import type { Meta, StoryObj } from '@storybook/react'
import { KakaoLoginButton, GoogleLoginButton } from './LoginButtons'

const meta = {
title: 'DOMAIN/LoginButtons',
component: KakaoLoginButton,
tags: ['autodocs'],
argTypes: {},
} satisfies Meta<typeof KakaoLoginButton>

export default meta
type Story = StoryObj<typeof meta>

export const Normal: Story = {
args: {},
render: () => (
<section className="flex flex-col gap-3">
<KakaoLoginButton onClickButton={() => alert('카카오 버튼')} />
<GoogleLoginButton onClickButton={() => alert('구글 버튼')} />
</section>
),
}

export const Kakao: Story = {
render: () => <KakaoLoginButton onClickButton={() => alert('카카오 버튼')} />,
}

export const Google: Story = {
render: () => <GoogleLoginButton onClickButton={() => alert('구글 버튼')} />,
}
42 changes: 42 additions & 0 deletions src/components/domain/buttons/LoginButtons/LoginButtons.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import React from 'react'
import Image from 'next/image'
import Button from '@/components/ui/Button'
import Assets from '@/config/assets'

const KakaoLoginButton = ({ onClickButton }: { onClickButton: () => void }) => {
return (
<Button
onClick={onClickButton}
className="relative h-10 text-black transition-all bg-kakao-color hover:brightness-90 w-80 hover:bg-kakao-color"
>
<Image
className="absolute flex-shrink-0 left-3"
src={Assets.kakaoIcon}
alt="카카오 로그인"
/>
카카오 계정으로 시작하기
</Button>
)
}

const GoogleLoginButton = ({
onClickButton,
}: {
onClickButton: () => void
}) => {
return (
<Button
onClick={onClickButton}
className="relative h-10 text-black transition-all bg-white border border-gray hover:brightness-90 w-80 hover:bg-white"
>
<Image
className="absolute flex-shrink-0 left-3"
src={Assets.googleIcon}
alt="구글 로그인"
/>
구글 계정으로 시작하기
</Button>
)
}

export { KakaoLoginButton, GoogleLoginButton }
3 changes: 3 additions & 0 deletions src/components/domain/buttons/LoginButtons/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { KakaoLoginButton, GoogleLoginButton } from './LoginButtons'

export { KakaoLoginButton, GoogleLoginButton }
4 changes: 4 additions & 0 deletions src/config/assets.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import AlarmIcon from '/public/images/bell.svg'
import GoogleIcon from '/public/images/google.png'
import KakaoIcon from '/public/images/kakao.png'
import MenuIcon from '/public/images/menu-icon.svg'

const Assets = {
menuIcon: MenuIcon,
alarmIcon: AlarmIcon,
googleIcon: GoogleIcon,
kakaoIcon: KakaoIcon,
} as const

export default Assets
3 changes: 3 additions & 0 deletions src/styles/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const COLORS = {
gray: '#BFBFBF',
black: '#000000',
white: '#FFFFFF',
kakao: '#FEE103',

// dark: {
// primary_300: '#534CD0',
Expand All @@ -30,6 +31,7 @@ const LIGHT_THEMES = {
'text-color': COLORS.black,
'background-secondary-color': COLORS.gray,
'dialog-background-color': COLORS.black,
'kakao-color': COLORS.kakao,
} as const

const DARK_THEMES = {
Expand All @@ -41,6 +43,7 @@ const DARK_THEMES = {
'text-color': COLORS.white,
'background-secondary-color': COLORS.gray,
'dialog-background-color': COLORS.black,
'kakao-color': COLORS.kakao,
} as const

export default COLORS
Expand Down

0 comments on commit 0d86660

Please sign in to comment.