diff --git a/apps/storybook/stories/badge.stories.tsx b/apps/storybook/stories/badge.stories.tsx index 9141d9e9..282ca86f 100644 --- a/apps/storybook/stories/badge.stories.tsx +++ b/apps/storybook/stories/badge.stories.tsx @@ -1,4 +1,11 @@ import React from 'react'; +import { + CheckCircleIcon, + ExclamationCircleIcon, + ExclamationTriangleIcon, + InformationCircleIcon, + StarIcon, +} from '@heroicons/react/20/solid'; import type { ComponentMeta } from '@storybook/react'; import type { BadgeVariant } from '@tih/ui'; import { Badge } from '@tih/ui'; @@ -40,3 +47,23 @@ export function Variants() { ); } + +export function Icon() { + return ( +
+ + + + + +
+ ); +} diff --git a/packages/ui/src/Badge/Badge.tsx b/packages/ui/src/Badge/Badge.tsx index 305ee90f..3c5b2cd6 100644 --- a/packages/ui/src/Badge/Badge.tsx +++ b/packages/ui/src/Badge/Badge.tsx @@ -8,6 +8,7 @@ export type BadgeVariant = | 'warning'; type Props = Readonly<{ + endAddOn?: React.ComponentType>; label: string; variant: BadgeVariant; }>; @@ -41,7 +42,7 @@ const classes: Record< }, }; -export default function Badge({ label, variant }: Props) { +export default function Badge({ endAddOn: EndAddOn, label, variant }: Props) { const { backgroundClass, textClass } = classes[variant]; return ( @@ -51,7 +52,8 @@ export default function Badge({ label, variant }: Props) { backgroundClass, textClass, )}> - {label} + {label} + {EndAddOn &&