Skip to content

Commit d2820cd

Browse files
committed
[#42] ✨ add logo component + storybook
1 parent 4f6c64e commit d2820cd

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import Link from 'next/link'
2+
3+
import { LogoBlack, LogoGray, LogoWhite } from '@/assets/logoList'
4+
5+
type Variant = 'default' | 'primary' | 'secondary'
6+
7+
type LogoProps = { variant?: Variant }
8+
9+
const logoByVariant: Record<Variant, React.ReactElement> = {
10+
default: <LogoBlack />,
11+
primary: <LogoWhite />,
12+
secondary: <LogoGray />,
13+
}
14+
15+
export const Logo = ({ variant = 'default' }: LogoProps): JSX.Element => {
16+
const logo = logoByVariant[variant]
17+
18+
return <Link href={'/'}>{logo}</Link>
19+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { Logo } from '@/components/common/logo'
2+
3+
export default {
4+
title: 'Common/Logo/Logo',
5+
component: Logo,
6+
parameters: {
7+
layout: 'centered',
8+
},
9+
argTypes: {
10+
variant: {
11+
control: 'radio',
12+
options: ['default', 'primary', 'secondary'],
13+
description: '로고의 스타일을 결정하는 옵션입니다.',
14+
},
15+
},
16+
}
17+
18+
export const Default = {
19+
args: {
20+
variant: 'default',
21+
},
22+
}
23+
24+
export const Primary = {
25+
args: {
26+
variant: 'primary',
27+
},
28+
}
29+
30+
export const Secondary = {
31+
args: {
32+
variant: 'secondary',
33+
},
34+
}

0 commit comments

Comments
 (0)