Skip to content

Commit

Permalink
feat(design): Add Popconfirm docs and demos
Browse files Browse the repository at this point in the history
  • Loading branch information
dengfuping committed Nov 20, 2024
1 parent f395cbd commit f14e266
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 0 deletions.
1 change: 1 addition & 0 deletions .dumirc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ export default defineConfig({
{ title: 'Modal 对话框', link: '/components/modal' },
{ title: 'Drawer 抽屉', link: '/components/drawer' },
{ title: 'Notification 通知提醒框', link: '/components/notification' },
{ title: 'Popconfirm 气泡确认框', link: '/components/popconfirm' },
{ title: 'Progress 进度条', link: '/components/progress' },
{ title: 'Result 结果', link: '/components/result' },
{ title: 'Skeleton 骨架屏', link: '/components/skeleton' },
Expand Down
21 changes: 21 additions & 0 deletions packages/design/src/popconfirm/demo/basic.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react';
import { Button, message, Popconfirm } from '@oceanbase/design';

const App: React.FC = () => (
<Popconfirm
title="Delete the task"
description="Are you sure to delete this task?"
onConfirm={e => {
console.log(e);
message.success('Click on Yes');
}}
onCancel={e => {
console.log(e);
message.info('Click on No');
}}
>
<Button danger>Delete</Button>
</Popconfirm>
);

export default App;
21 changes: 21 additions & 0 deletions packages/design/src/popconfirm/demo/promise.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react';
import { Button, message, Popconfirm } from '@oceanbase/design';

const App: React.FC = () => (
<Popconfirm
title="Delete the task"
description="Are you sure to delete this task?"
onConfirm={() => {
return new Promise(resolve => {
setTimeout(() => {
resolve(null);
message.success('The task is deleted');
}, 3000);
});
}}
>
<Button danger>Delete</Button>
</Popconfirm>
);

export default App;
19 changes: 19 additions & 0 deletions packages/design/src/popconfirm/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: Popconfirm 气泡确认框
nav:
title: 基础组件
path: /components
---

- 🔥 完全继承 antd [Popconfirm](https://ant.design/components/popconfirm-cn) 的能力和 API,可无缝切换。
- 💄 定制主题和样式,符合 OceanBase Design 设计规范。

## 代码演示

<code src="./demo/basic.tsx" title="基本"></code>

<code src="./demo/promise.tsx" title="基于 Promise 的异步关闭" description="点击确定后异步关闭气泡确认框。"></code>

## API

- 详见 antd Popconfirm 文档: https://ant.design/components/popconfirm-cn

0 comments on commit f14e266

Please sign in to comment.