Seed: event template (15 files)
This commit is contained in:
@@ -0,0 +1,33 @@
|
|||||||
|
import * as React from "react";
|
||||||
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
|
const badgeStyles: Record<string, string> = {
|
||||||
|
default: "bg-indigo-600 text-white",
|
||||||
|
secondary: "bg-slate-100 text-slate-900",
|
||||||
|
outline: "border border-slate-300 text-slate-900",
|
||||||
|
destructive: "bg-red-600 text-white",
|
||||||
|
success: "bg-emerald-100 text-emerald-700",
|
||||||
|
};
|
||||||
|
|
||||||
|
export interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> {
|
||||||
|
variant?: keyof typeof badgeStyles;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Badge({ className, variant = "default", ...props }: BadgeProps) {
|
||||||
|
return (
|
||||||
|
<span
|
||||||
|
className={cn(
|
||||||
|
"inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold",
|
||||||
|
badgeStyles[variant] || badgeStyles.default,
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function badgeVariants(opts?: { variant?: string; className?: string }) {
|
||||||
|
return cn("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold", badgeStyles[opts?.variant || "default"], opts?.className);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Badge;
|
||||||
Reference in New Issue
Block a user