mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-21 13:18:04 +08:00
451d2f6ee2
* feat(popconfirm): make title bold and add description prop * feat(popconfirm): make title bold and add description prop(update demos) * feat(popconfirm): make title bold and add description prop(the update of demos translation) * feat(popconfirm): make title bold and add description prop(the update of snapshot) * feat(popconfirm): make title bold and add description prop(the update of popconfirm md) * feat(popconfirm): make title bold and add description prop(the update of popconfirm md)2 * feat(popconfirm): make title bold and add description prop(run all test.ts.snaps and update popconfirm)
43 lines
923 B
TypeScript
43 lines
923 B
TypeScript
import React, { useState } from 'react';
|
|
import { Button, Popconfirm } from 'antd';
|
|
|
|
const App: React.FC = () => {
|
|
const [open, setOpen] = useState(false);
|
|
const [confirmLoading, setConfirmLoading] = useState(false);
|
|
|
|
const showPopconfirm = () => {
|
|
setOpen(true);
|
|
};
|
|
|
|
const handleOk = () => {
|
|
setConfirmLoading(true);
|
|
|
|
setTimeout(() => {
|
|
setOpen(false);
|
|
setConfirmLoading(false);
|
|
}, 2000);
|
|
};
|
|
|
|
const handleCancel = () => {
|
|
console.log('Clicked cancel button');
|
|
setOpen(false);
|
|
};
|
|
|
|
return (
|
|
<Popconfirm
|
|
title="Title"
|
|
description="Open Popconfirm with async logic"
|
|
open={open}
|
|
onConfirm={handleOk}
|
|
okButtonProps={{ loading: confirmLoading }}
|
|
onCancel={handleCancel}
|
|
>
|
|
<Button type="primary" onClick={showPopconfirm}>
|
|
Open Popconfirm with async logic
|
|
</Button>
|
|
</Popconfirm>
|
|
);
|
|
};
|
|
|
|
export default App;
|