refactor: 拆分管理端入口并优化构建分包
This commit is contained in:
1 parent
0f6ad8b993
commit
bf4bbf81c7
17 files changed
+455
-353
No files matched your search
@@ -0,0 +1,6 @@
|
||||
import { Button } from "antd";
|
||||
import type { ButtonProps } from "antd";
|
||||
|
||||
export function AdminButton(props: ButtonProps) {
|
||||
return <Button {...props} />;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { Card } from "antd";
|
||||
import type { CardProps } from "antd";
|
||||
|
||||
export function AdminCard(props: CardProps) {
|
||||
return <Card {...props} />;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import { App, ConfigProvider } from "antd";
|
||||
import type { ConfigProviderProps } from "antd";
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
export function AdminConfigProvider({
|
||||
children,
|
||||
...props
|
||||
}: ConfigProviderProps & { children?: ReactNode }) {
|
||||
return (
|
||||
<ConfigProvider {...props}>
|
||||
<App>{children}</App>
|
||||
</ConfigProvider>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export { Form as AdminForm, Input as AdminInput } from "antd";
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Layout } from "antd";
|
||||
import type { BasicProps } from "antd/es/layout/layout";
|
||||
|
||||
function AdminLayoutBase(props: BasicProps) {
|
||||
return <Layout {...props} />;
|
||||
}
|
||||
|
||||
export const AdminLayout = Object.assign(AdminLayoutBase, {
|
||||
Sider: Layout.Sider,
|
||||
Header: Layout.Header,
|
||||
Content: Layout.Content,
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
import { Menu } from "antd";
|
||||
import type { MenuProps } from "antd";
|
||||
|
||||
export function AdminMenu(props: MenuProps) {
|
||||
return <Menu {...props} />;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export { message as adminMessage } from "antd";
|
||||
@@ -0,0 +1,6 @@
|
||||
import { Select } from "antd";
|
||||
import type { SelectProps } from "antd";
|
||||
|
||||
export function AdminSelect(props: SelectProps) {
|
||||
return <Select {...props} />;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import { Skeleton } from "antd";
|
||||
import type { SkeletonProps } from "antd";
|
||||
|
||||
export function AdminSkeleton(props: SkeletonProps) {
|
||||
return <Skeleton {...props} />;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { AdminCard } from "./AdminCard.js";
|
||||
import { AdminSkeleton } from "./AdminSkeleton.js";
|
||||
|
||||
export function LoadingStack({ rows = 3 }: { rows?: number }) {
|
||||
return (
|
||||
<div className="admin-loading-stack">
|
||||
<AdminCard>
|
||||
<AdminSkeleton active paragraph={{ rows: 2 }} title={false} />
|
||||
</AdminCard>
|
||||
{Array.from({ length: rows }).map((_, index) => (
|
||||
<AdminCard key={index}>
|
||||
<AdminSkeleton active paragraph={{ rows: 1 }} title={false} />
|
||||
</AdminCard>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Button, Card, Skeleton } from "antd";
|
||||
import { Button } from "antd";
|
||||
import type { ReactNode } from "react";
|
||||
import { LoadingStack } from "./LoadingStack.js";
|
||||
|
||||
function errorMessage(error: unknown, fallback: string) {
|
||||
return error instanceof Error ? error.message : fallback;
|
||||
@@ -21,21 +22,6 @@ export function QueryState({
|
||||
return <>{children}</>;
|
||||
}
|
||||
|
||||
export function LoadingStack({ rows = 3 }: { rows?: number }) {
|
||||
return (
|
||||
<div className="admin-loading-stack">
|
||||
<Card>
|
||||
<Skeleton active paragraph={{ rows: 2 }} title={false} />
|
||||
</Card>
|
||||
{Array.from({ length: rows }).map((_, index) => (
|
||||
<Card key={index}>
|
||||
<Skeleton active paragraph={{ rows: 1 }} title={false} />
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function ErrorNote({
|
||||
error,
|
||||
onRetry,
|
||||
|
||||
Reference in new issue
Block a user