Spaces:
Sleeping
Sleeping
| import * as React from 'react'; | |
| export interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement> { | |
| variant?: 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'info' | 'purple' | 'neutral'; | |
| } | |
| export default function Badge({ | |
| children, | |
| className = '', | |
| variant = 'neutral', | |
| ...props | |
| }: BadgeProps) { | |
| const baseStyle = 'inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium border transition-all duration-150'; | |
| const variants = { | |
| neutral: 'bg-neutral-50 text-neutral-600 border-neutral-200', | |
| primary: 'bg-neutral-900 text-white border-neutral-900', | |
| secondary: 'bg-neutral-100 text-neutral-700 border-neutral-200', | |
| info: 'bg-blue-50 text-blue-600 border-blue-100', | |
| success: 'bg-emerald-50 text-emerald-700 border-emerald-100', | |
| warning: 'bg-amber-50 text-amber-700 border-amber-100', | |
| danger: 'bg-red-50 text-red-700 border-red-100', | |
| purple: 'bg-purple-50 text-purple-700 border-purple-100', | |
| }; | |
| return ( | |
| <span className={`${baseStyle} ${variants[variant]} ${className}`} {...props}> | |
| {children} | |
| </span> | |
| ); | |
| } | |