c5200c7d45
## 变更内容 - 新增基于 shadcn open-code 模式的共享 UI canonical 组件、样式与导出。 - 新增 `/components` 共享组件展示页,并覆盖平台组件、Token、状态和移动端布局。 - 补齐平台展示页的筛选、排序、上传预览、标签、开关和异步状态交互。 - 修复排序导致预览主题变化、筛选弹窗误关闭和入口状态不更新的问题。 - 同步网站与客户端构建别名、依赖、路由测试和项目文档。 ## 验证 - `npm run test -- src/components/shared-components/SharedComponentsShowcasePage.test.tsx` - `npm run typecheck` - `npm run check:encoding` - `npm run build:raw` - `git diff --check` - pre-push 门禁通过 Reviewed-on: http://192.168.35.82/git/GenarrativeAI/Genarrative/pulls/202 Co-authored-by: kdletters <kdletters@qq.com> Co-committed-by: kdletters <kdletters@qq.com>
45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
import type { ReactNode } from 'react';
|
|
|
|
export type PlatformFieldLabelVariant =
|
|
| 'field'
|
|
| 'section'
|
|
| 'form'
|
|
| 'inlineForm'
|
|
| 'pill'
|
|
| 'accentPill';
|
|
|
|
export type PlatformFieldLabelProps = {
|
|
children: ReactNode;
|
|
variant?: PlatformFieldLabelVariant;
|
|
className?: string;
|
|
};
|
|
|
|
const PLATFORM_FIELD_LABEL_CLASS: Record<PlatformFieldLabelVariant, string> = {
|
|
field: 'text-xs font-bold text-[var(--platform-text-soft)]',
|
|
section:
|
|
'text-xs font-bold tracking-[0.18em] text-[var(--platform-text-soft)]',
|
|
form: 'mb-2 block text-sm font-black text-[var(--platform-text-strong)]',
|
|
inlineForm:
|
|
'inline-flex items-center text-sm font-bold text-[var(--platform-text-base)]',
|
|
pill: 'mb-2 inline-flex rounded-full px-2 py-0.5 text-sm font-black text-[var(--platform-text-strong)]',
|
|
accentPill:
|
|
'mb-2 inline-flex rounded-full border border-rose-200/70 bg-rose-50/88 px-2.5 py-1 text-sm font-black text-rose-700 shadow-sm',
|
|
};
|
|
|
|
/** 平台字段标签,供子面板和表单控件复用。 */
|
|
export function PlatformFieldLabel({
|
|
children,
|
|
variant = 'field',
|
|
className,
|
|
}: PlatformFieldLabelProps) {
|
|
return (
|
|
<span
|
|
className={[PLATFORM_FIELD_LABEL_CLASS[variant], className]
|
|
.filter(Boolean)
|
|
.join(' ')}
|
|
>
|
|
{children}
|
|
</span>
|
|
);
|
|
}
|