Skyroc Admin Docs
Web

@skyroc/web-ui-antd

基于 Ant Design 的 Admin 专用复合组件(按钮 / 异常页 / 全屏 …)

概览

包名@skyroc/web-ui-antd
目录packages/web/ui/antd
版本0.1.0
依赖@skyroc/web-ui-compose@iconify/reactclsx
peer@tanstack/react-routerantdreact-error-boundary
测试

@skyroc/web-ui-antd 提供一组面向 Admin 应用、绑定 antd UI 风格的复合组件。它建立在 @skyroc/web-ui-compose 之上,添加了 antd 风格的按钮变体、异常页、全屏与刷新按钮等。

组件清单

组件用途
BeyondHiding单行超出隐藏 + tooltip 显示
ButtonIcon带 hover 动画的图标按钮(含 IconHoverAnimation 类型)
ButtonLinkTanStack Router Link 风格的按钮(ButtonLinkComponentProps
ErrorBoundary基于 react-error-boundary 的 antd 风格错误兜底
ExceptionBase403/404/500 异常页基础组件(业务页可基于它拼装)
FullScreen切换全屏的按钮 + 状态 hook
PinToggler钉住 / 取消钉住按钮
ReloadButton刷新按钮

目录结构

src/
├── index.ts
├── styles.d.ts                                     # CSS module 类型声明
└── components/
    ├── BeyondHiding.tsx
    ├── ButtonIcon.tsx
    ├── ButtonLink.tsx
    ├── ErrorBoundary.tsx
    ├── ExceptionBase.tsx
    ├── FullScreen.tsx
    ├── PinToggler.tsx
    ├── ReloadButton.tsx
    └── styles/button-icon-animations.css

主入口导出

export {
  BeyondHiding,
  ButtonIcon,
  ButtonLink,
  ErrorBoundary,
  ExceptionBase,
  FullScreen,
  PinToggler,
  ReloadButton
};
export type { ButtonIconProps, ButtonLinkComponentProps, IconHoverAnimation };

典型用法

import { ButtonLink } from '@skyroc/web-ui-antd';

<ButtonLink to="/manage/user" type="primary">
  跳转到用户管理
</ButtonLink>;

底层用 TanStack Router 的 Link,自动获得类型安全的 to、预加载行为。

异常页

import { ExceptionBase } from '@skyroc/web-ui-antd';

// 403 / 404 / 500
<ExceptionBase
  type="404"
  homePath="/home"
  onBackHome={() => navigate({ to: '/home' })}
/>;

apps/admin/src/pages/(errors)/* 直接基于它实现三个异常页面。

全屏

import { FullScreen } from '@skyroc/web-ui-antd';

<FullScreen className="text-xl" full={false} />;

@skyroc/web-admin-layouts 的 Header 默认引入。

图标按钮

<ButtonIcon
  icon="mdi:refresh"
  iconHoverAnimation="rotate"
  onClick={refresh}
/>;

IconHoverAnimation 提供旋转、缩放、上下浮动等内置动画。

与 compose 的分工

内容
基础@skyroc/web-ui-composeBetterScroll、Portal、Table Hook 体系等通用复合
antd 业务层@skyroc/web-ui-antd异常页、按钮变体、全屏等 antd 风味组件

两层各司其职:compose 关心"通用 UI 模式",web-ui-antd 关心"antd 主题下的 admin 业务交互"。

注意

包内无 README、无 __tests__。它的定位接近"业务壳层",预期跟随 admin 业务一起迭代。

On this page