Replace 145 scattered 10px and 11px declarations with semantic text roles across the dashboard, configuration, diagnostics, logs, and settings surfaces. Promote instructions, errors, interactive labels, and empty states to at least 12px, raise security-sensitive and destructive warnings to 14px, and make general-purpose badges readable by default. Keep compact sizing only for dense technical metadata such as timestamps, identifiers, paths, versions, and counters. Preserve the existing desktop density while improving Chinese text legibility and responsive behavior on narrow mobile layouts.
29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
import * as React from 'react';
|
|
import { cva, type VariantProps } from 'class-variance-authority';
|
|
import { cn } from '@/lib/utils';
|
|
|
|
const badgeVariants = cva(
|
|
'inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium transition-colors',
|
|
{
|
|
variants: {
|
|
variant: {
|
|
default: 'border-transparent bg-primary/15 text-primary',
|
|
secondary: 'border-transparent bg-secondary text-secondary-foreground',
|
|
destructive: 'border-transparent bg-destructive/15 text-destructive',
|
|
success: 'border-transparent bg-success/15 text-success',
|
|
warning: 'border-transparent bg-warning/15 text-warning',
|
|
outline: 'border-border text-foreground',
|
|
},
|
|
},
|
|
defaultVariants: { variant: 'default' },
|
|
}
|
|
);
|
|
|
|
export interface BadgeProps extends React.HTMLAttributes<HTMLSpanElement>, VariantProps<typeof badgeVariants> {}
|
|
|
|
function Badge({ className, variant, ...props }: BadgeProps) {
|
|
return <span className={cn(badgeVariants({ variant }), className)} {...props} />;
|
|
}
|
|
|
|
export { Badge, badgeVariants };
|