-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Feat: Badge 컴포넌트 추가 및 컬러값 추가
- Loading branch information
Showing
3 changed files
with
62 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
import Badge from './Badge' | ||
|
||
const meta: Meta<typeof Badge> = { | ||
component: Badge, | ||
tags: ['autodocs'], | ||
title: 'components/Badge', | ||
argTypes: { | ||
value: { | ||
control: 'text' | ||
}, | ||
isSelected: { | ||
control: 'select', | ||
options: [true, false] | ||
} | ||
} | ||
} | ||
export default meta | ||
type Story = StoryObj<typeof Badge> | ||
|
||
export const Default: Story = { | ||
render: (args) => <Badge value={args.value} isSelected={args.isSelected} /> | ||
} |
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,16 @@ | ||
interface BadgeProps { | ||
value: string | ||
isSelected: boolean | ||
} | ||
const Badge = ({ value, isSelected }: BadgeProps) => { | ||
return ( | ||
<div | ||
className={`rounded-[100px] flex justify-center items-center w-full h-full px-[8px] py-[4px] ${ | ||
isSelected ? 'bg-green-5 text-green-50' : 'bg-gray-5 text-gray-50' | ||
} `}> | ||
{value} | ||
</div> | ||
) | ||
} | ||
|
||
export default Badge |
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