-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
316 additions
and
14 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
NEXT_PUBLIC_API_MOCKING=enabled # or disabled | ||
NEXT_PUBLIC_API_MOCKING=enabled # or disabled | ||
CHROMATIC_TOKEN=your-token |
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 |
---|---|---|
@@ -1,17 +1,23 @@ | ||
name: 'Chromatic Deployment' | ||
name: 'Chromatic' | ||
|
||
on: | ||
# 원하는 브랜치 명으로 바꿔주시면 됩니다. | ||
push: | ||
pull_request: | ||
branches: ['develop'] | ||
|
||
jobs: | ||
test: | ||
chromatic-deployment: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- run: yarn | ||
- uses: chromaui/action@v1 | ||
- name: Install dependencies | ||
run: | | ||
npm install -g pnpm | ||
- name: Install Dependency | ||
run: pnpm install | ||
|
||
- name: Publish to Chromatic | ||
uses: chromaui/action@v1 | ||
|
||
with: | ||
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }} | ||
token: ${{ secrets.GITHUB_TOKEN }} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 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 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 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
30 changes: 30 additions & 0 deletions
30
src/components/domain/buttons/LoginButtons/LoginButtons.stories.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 @@ | ||
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
42
src/components/domain/buttons/LoginButtons/LoginButtons.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,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 } |
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,3 @@ | ||
import { KakaoLoginButton, GoogleLoginButton } from './LoginButtons' | ||
|
||
export { KakaoLoginButton, GoogleLoginButton } |
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,34 @@ | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
import { Avatar, AvatarImage, AvatarFallback } from './Avatar' | ||
|
||
const meta = { | ||
title: 'UI/Avatar', | ||
component: Avatar, | ||
tags: ['autodocs'], | ||
argTypes: {}, | ||
} satisfies Meta<typeof Avatar> | ||
|
||
export default meta | ||
type Story = StoryObj<typeof meta> | ||
|
||
export const Normal: Story = { | ||
args: {}, | ||
render: () => { | ||
return ( | ||
<> | ||
<Avatar size="sm"> | ||
<AvatarImage src="https://github.com/shadcn.png" /> | ||
<AvatarFallback>NB</AvatarFallback> | ||
</Avatar> | ||
<Avatar size="md"> | ||
<AvatarImage src="https://github.com/shadcn.png" /> | ||
<AvatarFallback>NB</AvatarFallback> | ||
</Avatar> | ||
<Avatar size="lg"> | ||
<AvatarImage src="https://github.com/shadcn.png" /> | ||
<AvatarFallback>NB</AvatarFallback> | ||
</Avatar> | ||
</> | ||
) | ||
}, | ||
} |
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,67 @@ | ||
'use client' | ||
|
||
import * as React from 'react' | ||
import * as AvatarPrimitive from '@radix-ui/react-avatar' | ||
import { cva, type VariantProps } from 'class-variance-authority' | ||
import { cn } from '@/utils' | ||
|
||
const avatarVariants = cva( | ||
'relative flex shrink-0 overflow-hidden rounded-full', | ||
{ | ||
variants: { | ||
size: { | ||
sm: 'w-6 h-6', | ||
md: 'w-10 h-10', | ||
lg: 'w-[100px] h-[100px]', | ||
}, | ||
}, | ||
}, | ||
) | ||
|
||
export interface AvatarProps | ||
extends React.HTMLAttributes<HTMLSpanElement>, | ||
VariantProps<typeof avatarVariants> { | ||
ref?: React.Ref<HTMLSpanElement> | ||
} | ||
|
||
const Avatar = React.forwardRef< | ||
React.ElementRef<typeof AvatarPrimitive.Root>, | ||
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root> & | ||
VariantProps<typeof avatarVariants> | ||
>(({ className, size, ...props }: AvatarProps, ref) => ( | ||
<AvatarPrimitive.Root | ||
ref={ref} | ||
className={cn(avatarVariants({ size }), className)} | ||
{...props} | ||
/> | ||
)) | ||
Avatar.displayName = AvatarPrimitive.Root.displayName | ||
|
||
const AvatarImage = React.forwardRef< | ||
React.ElementRef<typeof AvatarPrimitive.Image>, | ||
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image> | ||
>(({ className, ...props }, ref) => ( | ||
<AvatarPrimitive.Image | ||
ref={ref} | ||
className={cn('aspect-square h-full w-full', className)} | ||
{...props} | ||
/> | ||
)) | ||
AvatarImage.displayName = AvatarPrimitive.Image.displayName | ||
|
||
const AvatarFallback = React.forwardRef< | ||
React.ElementRef<typeof AvatarPrimitive.Fallback>, | ||
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback> | ||
>(({ className, ...props }, ref) => ( | ||
<AvatarPrimitive.Fallback | ||
ref={ref} | ||
className={cn( | ||
'flex h-full w-full items-center justify-center rounded-full ', | ||
className, | ||
)} | ||
{...props} | ||
/> | ||
)) | ||
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName | ||
|
||
export { Avatar, AvatarImage, AvatarFallback } |
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,3 @@ | ||
import { Avatar, AvatarImage, AvatarFallback } from './Avatar' | ||
|
||
export { Avatar, AvatarImage, AvatarFallback } |
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
Oops, something went wrong.