-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(design): Add Popconfirm docs and demos
- Loading branch information
1 parent
f395cbd
commit f14e266
Showing
4 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |