import type { ReactNode } from 'react';

import { cn } from '@/lib/utils';

const tones = {
  neutral: 'bg-neutral/10 text-neutral',
  info: 'bg-info/10 text-info',
  success: 'bg-success/10 text-success',
  warning: 'bg-warning/10 text-warning',
  danger: 'bg-danger/10 text-danger',
  primary: 'bg-primary/10 text-primary',
  accent: 'bg-accent/10 text-accent',
} as const;

export function Badge({
  tone = 'neutral',
  children,
  className,
}: {
  tone?: keyof typeof tones;
  children: ReactNode;
  className?: string;
}) {
  return <span className={cn('inline-flex items-center rounded-control px-2 py-0.5 text-caption font-medium', tones[tone], className)}>{children}</span>;
}
