Skip to content

Commit

Permalink
update badge
Browse files Browse the repository at this point in the history
  • Loading branch information
vassbence committed Aug 2, 2024
1 parent 8da0ea2 commit 08fca42
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 8 deletions.
15 changes: 8 additions & 7 deletions src/components/Badge/Badge.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ export const Default = {
}}
>
{['subtle', 'fill'].map((variant) =>
['neutral', 'red', 'indigo', 'green', 'amber'].map((color) =>
[{}, { leadIcon: 'arrow-up' }, { trailIcon: 'arrow-up' }].map(
(icon) => (
<Badge color={`${color}-${variant}` as any} {...(icon as any)}>
Badge
</Badge>
['neutral', 'red', 'indigo', 'green', 'amber', 'inverted', 'white'].map(
(color) =>
[{}, { leadIcon: 'arrow-up' }, { trailIcon: 'arrow-up' }].map(
(icon) => (
<Badge color={`${color}-${variant}` as any} {...(icon as any)}>
Badge
</Badge>
),
),
),
),
)}
</div>
Expand Down
22 changes: 21 additions & 1 deletion src/components/Badge/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ type BadgeProps = {
| 'green-fill'
| 'amber-subtle'
| 'amber-fill'
| 'white-subtle'
| 'white-fill'
| 'inverted-subtle'
| 'inverted-fill'
leadIcon?: IconProps['variant']
trailIcon?: IconProps['variant']
}
Expand Down Expand Up @@ -65,7 +69,7 @@ function Badge({
color: colors.white100,
}),
...(color === 'neutral-subtle' && {
background: colors.neutral20,
background: colors.neutral20Adjusted,
color: colors.neutral100,
}),
...(color === 'red-subtle' && {
Expand All @@ -84,6 +88,22 @@ function Badge({
background: colors.amber20,
color: colors.amber100,
}),
...(color === 'inverted-subtle' && {
background: colors.neutralInverted20,
color: colors.neutralInverted100,
}),
...(color === 'inverted-fill' && {
background: colors.neutralInverted100,
color: colors.neutral100,
}),
...(color === 'white-subtle' && {
background: colors.white20,
color: colors.white100,
}),
...(color === 'white-fill' && {
background: colors.white100,
color: colors.black100,
}),
}}
>
{leadIcon && <Icon size="small" variant={leadIcon} />}
Expand Down

0 comments on commit 08fca42

Please sign in to comment.