Files
likedream-web/src/components/ui/badge/index.ts
T
sugarBecomer 18fcae8030 🎨 主题 v2:渐变按钮 + 4层语义色 + 降低饱和度
1. Primary 按钮改为渐变背景 linear-gradient(135deg, #6b8cff, #88a4ff)
2. 全局 primary 饱和度从 0.19 降至 0.12,更柔和
3. destructive 改为珊瑚色 oklch(0.70 0.14 25)
4. 新增 success/warning/info 三个语义色变量
5. Badge 新增 success/warning/info variant
6. 视图层硬编码 text-green/text-red/text-yellow 全部替换为语义 token
7. chart 颜色同步降低饱和度
2026-04-27 10:32:59 +08:00

33 lines
1.6 KiB
TypeScript

import type { VariantProps } from "class-variance-authority"
import { cva } from "class-variance-authority"
export { default as Badge } from "./Badge.vue"
export const badgeVariants = cva(
"inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
{
variants: {
variant: {
default:
"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",
secondary:
"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",
destructive:
"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
success:
"border-transparent bg-success text-success-foreground [a&]:hover:bg-success/90",
warning:
"border-transparent bg-warning text-warning-foreground [a&]:hover:bg-warning/90",
info:
"border-transparent bg-info text-info-foreground [a&]:hover:bg-info/90",
outline:
"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",
},
},
defaultVariants: {
variant: "default",
},
},
)
export type BadgeVariants = VariantProps<typeof badgeVariants>