feat: 完善后台设计语言细节

- 统一说明文案层级:Typography.Paragraph 次要文案迁移到 admin-section-description
- 状态色补齐边框与中间调令牌,Alert/错误条/Descriptions 与 StatusTag 同源
- 咨询详情描述列表去表格线,改为键值展示并统一令牌
- 新增 BrandMark,侧栏与登录页标识改用品牌首字
- 信任内容改用列表行,空状态、表格骨架屏、主按钮脏检查落地
- design.md 同步令牌映射、切换控件选型与组件清单
This commit is contained in:
que01 committed 2026-10-14 11:21:31 +08:00
1 parent 2f26828f09
commit 3ef46b0aa8
25 files changed
+836 -393

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
/**
* 品牌标识:取品牌名首字渲染单字标记,未取到品牌时回落到中性字。
* 视觉规则见 apps/admin/design.md 的「侧栏导航」。
*/
export function BrandMark({
name,
fallback = "品",
className = "admin-sider-brand-mark",
}: {
name?: string | null | undefined;
fallback?: string;
className?: string;
}) {
const trimmed = name?.trim() ?? "";
const mark = Array.from(trimmed)[0] ?? fallback;
return <span className={className}>{mark}</span>;
}
+25
View File
@@ -0,0 +1,25 @@
import type { ReactNode } from "react";
export function EmptyState({
icon,
title,
description,
action,
compact = false,
}: {
icon?: ReactNode;
title: string;
description?: string;
action?: ReactNode;
compact?: boolean;
}) {
const className = compact ? "admin-empty admin-empty--compact" : "admin-empty";
return (
<div className={className}>
{icon ? <span className="admin-empty__icon">{icon}</span> : null}
<p className="admin-empty__title">{title}</p>
{description ? <p className="admin-empty__description">{description}</p> : null}
{action ? <div className="admin-empty__action">{action}</div> : null}
</div>
);
}
+1 -5
View File
@@ -1,4 +1,4 @@
import { Button, Card, Empty, Skeleton } from "antd";
import { Button, Card, Skeleton } from "antd";
import type { ReactNode } from "react";
function errorMessage(error: unknown, fallback: string) {
@@ -59,7 +59,3 @@ export function ErrorNote({
export function MutationError({ error }: { error?: unknown }) {
return <ErrorNote error={error} />;
}
export function EmptyState({ description }: { description: string }) {
return <Empty description={description} image={Empty.PRESENTED_IMAGE_SIMPLE} />;
}
@@ -88,7 +88,7 @@ export function RecordContentEditor({
}
/>
{save.isPending ? <Typography.Text type="secondary">正在保存内容…</Typography.Text> : null}
<Typography.Paragraph type="secondary">{section.description}</Typography.Paragraph>
<p className="admin-section-description">{section.description}</p>
<div className="admin-flex-1">
<RecordContentFields section={section} />
</div>
@@ -0,0 +1,29 @@
import { Skeleton } from "antd";
export function TableSkeleton({ rows = 4 }: { rows?: number }) {
return (
<div className="admin-table-skeleton" role="status" aria-live="polite">
{Array.from({ length: rows }).map((_, index) => (
<div key={index} className="admin-table-skeleton__row">
<Skeleton.Input active size="small" block />
</div>
))}
</div>
);
}
export function ListSkeleton({ rows = 3 }: { rows?: number }) {
return (
<div className="admin-list-skeleton" role="status" aria-live="polite">
{Array.from({ length: rows }).map((_, index) => (
<div key={index} className="admin-list-skeleton__row">
<Skeleton.Input active size="small" className="admin-list-skeleton__thumb" />
<div className="admin-list-skeleton__body">
<Skeleton.Input active size="small" block />
<Skeleton.Input active size="small" block />
</div>
</div>
))}
</div>
);
}
@@ -1,4 +1,4 @@
import { Button, Card, Collapse, Empty, Form, Input, Space, Typography } from "antd";
import { Button, Card, Collapse, Form, Input, Space, Typography } from "antd";
import {
CaretDownOutlined,
CaretUpOutlined,
@@ -6,6 +6,7 @@ import {
PlusOutlined,
} from "@ant-design/icons";
import type { TemplateAdminField } from "@personal-brand/api-client";
import { EmptyState } from "./EmptyState.js";
export function TemplateListField({
field,
@@ -29,12 +30,7 @@ export function TemplateListField({
>
{(rows, { add, remove, move }, { errors }) => (
<div className="admin-stack admin-stack-tight">
{rows.length === 0 ? (
<Empty
image={Empty.PRESENTED_IMAGE_SIMPLE}
description={`还没有${field.label}内容`}
/>
) : null}
{rows.length === 0 ? <EmptyState compact title={`还没有${field.label}内容`} /> : null}
{rows.map((row, index) => {
const titleField = field.itemFields?.[0];
const primaryTitle = titleField ? (