Skip to content

Commit 01bbba9

Browse files
committed
chore(Badge): upade to 5.0.0
1 parent 8026430 commit 01bbba9

File tree

2 files changed

+53
-8
lines changed

2 files changed

+53
-8
lines changed

src/Badge/Badge.stories.tsx

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const BrandColors: Story<BadgeProps> = (args) => {
3737
)
3838
}
3939

40-
export const Outline: Story<BadgeProps> = (args) => {
40+
export const SoftStyle: Story<BadgeProps> = (args) => {
4141
return (
4242
<div className="flex gap-2 items-center">
4343
<Badge {...args}>default</Badge>
@@ -53,10 +53,50 @@ export const Outline: Story<BadgeProps> = (args) => {
5353
</div>
5454
)
5555
}
56-
Outline.args = {
56+
SoftStyle.args = {
57+
variant: 'soft',
58+
}
59+
60+
export const OutlineStyle: Story<BadgeProps> = (args) => {
61+
return (
62+
<div className="flex gap-2 items-center">
63+
<Badge {...args}>default</Badge>
64+
<Badge {...args} color="primary">
65+
primary
66+
</Badge>
67+
<Badge {...args} color="secondary">
68+
secondary
69+
</Badge>
70+
<Badge {...args} color="accent">
71+
accent
72+
</Badge>
73+
</div>
74+
)
75+
}
76+
OutlineStyle.args = {
5777
variant: 'outline',
5878
}
5979

80+
export const DashStyle: Story<BadgeProps> = (args) => {
81+
return (
82+
<div className="flex gap-2 items-center">
83+
<Badge {...args}>default</Badge>
84+
<Badge {...args} color="primary">
85+
primary
86+
</Badge>
87+
<Badge {...args} color="secondary">
88+
secondary
89+
</Badge>
90+
<Badge {...args} color="accent">
91+
accent
92+
</Badge>
93+
</div>
94+
)
95+
}
96+
DashStyle.args = {
97+
variant: 'dash',
98+
}
99+
60100
export const Sizes: Story<BadgeProps> = (args) => {
61101
return (
62102
<div className="flex gap-2 items-center">

src/Badge/Badge.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,28 @@ import React, { forwardRef, ReactNode } from 'react'
22
import clsx from 'clsx'
33
import { twMerge } from 'tailwind-merge'
44

5-
import { IComponentBaseProps, ComponentColor, ComponentSize } from '../types'
5+
import {
6+
IComponentBaseProps,
7+
ComponentColor,
8+
ComponentSize,
9+
ComponentVariant,
10+
} from '../types'
611

712
export type BadgeProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'color'> &
813
IComponentBaseProps & {
9-
variant?: 'outline'
10-
outline?: boolean
1114
size?: ComponentSize
1215
color?: ComponentColor
16+
variant?: ComponentVariant
1317
responsive?: boolean
1418
}
1519

1620
const Badge = forwardRef<HTMLDivElement, BadgeProps>(
1721
(
1822
{
1923
children,
20-
variant,
21-
outline,
2224
size,
2325
color,
26+
variant,
2427
responsive,
2528
dataTheme,
2629
className,
@@ -36,7 +39,9 @@ const Badge = forwardRef<HTMLDivElement, BadgeProps>(
3639
'badge-md': size === 'md',
3740
'badge-sm': size === 'sm',
3841
'badge-xs': size === 'xs',
39-
'badge-outline': variant === 'outline' || outline,
42+
'badge-soft': variant === 'soft',
43+
'badge-dash': variant === 'dash',
44+
'badge-outline': variant === 'outline',
4045
'badge-neutral': color === 'neutral',
4146
'badge-primary': color === 'primary',
4247
'badge-secondary': color === 'secondary',

0 commit comments

Comments
 (0)