- 材质统一边光:slab / float / pill / pill-selected / seg-thumb / chrome-side 改为左上亮右下暗的 1px 边光 + 外侧暗线;新增 lens / field / chip 参数与 pg-float-modal - 主按钮:转动光谱环改为静态左上光谱高光,悬停沿边扫过一小段;次按钮同为 lens 玻璃 - Input / Textarea / SelectTrigger 挂 .field-glass,原生下拉与实体选择器同步;对话框按钮行 gap-3 - 提示条改 pg-float(状态色只在图标、展开不叠放);新增 GlassTooltip 接管 title 提示 - 触屏判断 input-modality.ts、touch / hover 自定义变体;animate-pg-pop 改 backwards;scroll-fade-end - 控制台外壳:侧栏无硬分隔线、折叠开关进标志行;顶栏去磨砂,右侧控件收进玻璃胶囊 - 登录页居中单卡 auth-card;详情头图「订阅」改回普通主按钮,删除 pill-solid;发现页海报角标改 glass-chip-media - 引入 simple-liquid-glass(liquid-surface.tsx);更新 docs/design 三份规范与 CHANGELOG Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Cxwgnn2pbzQ7rXv3rq7fei
44 lines
1.5 KiB
TypeScript
44 lines
1.5 KiB
TypeScript
import type { ReactNode } from "react";
|
|
import { cn } from "~/lib/utils.ts";
|
|
|
|
export type StatusTone = "success" | "warning" | "destructive" | "neutral";
|
|
|
|
// 状态色只表示状态,不做装饰(docs/design/interface-materials.md)
|
|
const TONE: Record<StatusTone, { box: string; dot: string }> = {
|
|
success: { box: "border-success/30 bg-success/10 text-success", dot: "bg-success" },
|
|
warning: { box: "border-warning/30 bg-warning/10 text-warning", dot: "bg-warning" },
|
|
destructive: { box: "border-destructive/30 bg-destructive/10 text-destructive", dot: "bg-destructive" },
|
|
neutral: { box: "border-border bg-foreground/[0.04] text-muted-foreground", dot: "bg-muted-foreground" },
|
|
};
|
|
|
|
/** 状态徽章:文字必填,不只靠颜色传达状态 */
|
|
export function StatusBadge({
|
|
tone = "neutral",
|
|
onMedia = false,
|
|
children,
|
|
className,
|
|
}: {
|
|
tone?: StatusTone;
|
|
/** 压在海报 / 剧照上:换成烟色小玻璃(glass-chip-media)白字,状态色只留在圆点上 */
|
|
onMedia?: boolean;
|
|
children: ReactNode;
|
|
className?: string;
|
|
}) {
|
|
const t = TONE[tone];
|
|
return (
|
|
<span
|
|
className={cn(
|
|
"inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-meta font-medium whitespace-nowrap",
|
|
onMedia ? "glass-chip-media" : ["border", t.box],
|
|
className,
|
|
)}
|
|
>
|
|
<span
|
|
aria-hidden
|
|
className={cn("h-1.5 w-1.5 rounded-full", onMedia && tone === "neutral" ? "bg-current opacity-70" : t.dot)}
|
|
/>
|
|
{children}
|
|
</span>
|
|
);
|
|
}
|