|
|
@ -10,6 +10,7 @@ export type BadgeVariant =
|
|
|
|
type Props = Readonly<{
|
|
|
|
type Props = Readonly<{
|
|
|
|
endAddOn?: React.ComponentType<React.ComponentProps<'svg'>>;
|
|
|
|
endAddOn?: React.ComponentType<React.ComponentProps<'svg'>>;
|
|
|
|
label: string;
|
|
|
|
label: string;
|
|
|
|
|
|
|
|
startAddOn?: React.ComponentType<React.ComponentProps<'svg'>>;
|
|
|
|
variant: BadgeVariant;
|
|
|
|
variant: BadgeVariant;
|
|
|
|
}>;
|
|
|
|
}>;
|
|
|
|
|
|
|
|
|
|
|
@ -42,7 +43,12 @@ const classes: Record<
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export default function Badge({ endAddOn: EndAddOn, label, variant }: Props) {
|
|
|
|
export default function Badge({
|
|
|
|
|
|
|
|
endAddOn: EndAddOn,
|
|
|
|
|
|
|
|
label,
|
|
|
|
|
|
|
|
startAddOn: StartAddOn,
|
|
|
|
|
|
|
|
variant,
|
|
|
|
|
|
|
|
}: Props) {
|
|
|
|
const { backgroundClass, textClass } = classes[variant];
|
|
|
|
const { backgroundClass, textClass } = classes[variant];
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
@ -52,6 +58,7 @@ export default function Badge({ endAddOn: EndAddOn, label, variant }: Props) {
|
|
|
|
backgroundClass,
|
|
|
|
backgroundClass,
|
|
|
|
textClass,
|
|
|
|
textClass,
|
|
|
|
)}>
|
|
|
|
)}>
|
|
|
|
|
|
|
|
{StartAddOn && <StartAddOn aria-hidden="true" className="mr-1 h-4 w-4" />}
|
|
|
|
<span>{label}</span>
|
|
|
|
<span>{label}</span>
|
|
|
|
{EndAddOn && <EndAddOn aria-hidden="true" className="ml-1 h-4 w-4" />}
|
|
|
|
{EndAddOn && <EndAddOn aria-hidden="true" className="ml-1 h-4 w-4" />}
|
|
|
|
</span>
|
|
|
|
</span>
|
|
|
|