feat: 重构后台品牌工作台基础骨架

This commit is contained in:
que01 committed 2026-09-20 16:41:57 +08:00
1 parent ac4abc1305
commit e402ba58d9
4 files changed
+209 -5

No files matched your search

@@ -0,0 +1,31 @@
import { Space, Typography } from "antd";
import type { ReactNode } from "react";
export function AdminPageHeader({
title,
description,
extra,
}: {
title: string;
description?: string;
extra?: ReactNode;
}) {
return (
<Space
align="start"
style={{ width: "100%", justifyContent: "space-between", marginBottom: 24 }}
>
<div>
<Typography.Title level={2} style={{ margin: 0 }}>
{title}
</Typography.Title>
{description && (
<Typography.Paragraph type="secondary" style={{ margin: "8px 0 0" }}>
{description}
</Typography.Paragraph>
)}
</div>
{extra}
</Space>
);
}
+47
View File
@@ -0,0 +1,47 @@
import { Alert, Button, Card, Empty, Result, Spin } from "antd";
import type { ReactNode } from "react";
export function QueryState({
loading,
error,
onRetry,
children,
}: {
loading?: boolean;
error?: unknown;
onRetry?: () => void;
children: ReactNode;
}) {
if (loading)
return (
<Card>
<Spin />
</Card>
);
if (error) {
return (
<Result
status="error"
title="内容加载失败"
subTitle={error instanceof Error ? error.message : "请检查 API 服务后重试"}
extra={onRetry ? <Button onClick={onRetry}>重新加载</Button> : undefined}
/>
);
}
return <>{children}</>;
}
export function EmptyState({ description }: { description: string }) {
return <Empty description={description} image={Empty.PRESENTED_IMAGE_SIMPLE} />;
}
export function MutationError({ error }: { error?: unknown }) {
if (!error) return null;
return (
<Alert
type="error"
showIcon
message={error instanceof Error ? error.message : "操作失败,请重试"}
/>
);
}