2024-05-17 15:39:30 +08:00
|
|
|
import React from 'react';
|
2024-06-22 21:59:12 +08:00
|
|
|
import { Button, notification, Space } from 'antd';
|
2024-05-17 15:39:30 +08:00
|
|
|
|
|
|
|
const App: React.FC = () => {
|
|
|
|
const [api, contextHolder] = notification.useNotification();
|
|
|
|
|
2024-05-27 13:35:37 +08:00
|
|
|
const openNotification = (pauseOnHover: boolean) => () => {
|
2024-05-17 15:39:30 +08:00
|
|
|
api.open({
|
|
|
|
message: 'Notification Title',
|
|
|
|
description:
|
|
|
|
'This is the content of the notification. This is the content of the notification. This is the content of the notification.',
|
|
|
|
showProgress: true,
|
2024-05-27 13:35:37 +08:00
|
|
|
pauseOnHover,
|
2024-05-17 15:39:30 +08:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
{contextHolder}
|
2024-05-27 13:35:37 +08:00
|
|
|
<Space>
|
|
|
|
<Button type="primary" onClick={openNotification(true)}>
|
|
|
|
Pause on hover
|
|
|
|
</Button>
|
|
|
|
<Button type="primary" onClick={openNotification(false)}>
|
|
|
|
Don't pause on hover
|
|
|
|
</Button>
|
|
|
|
</Space>
|
2024-05-17 15:39:30 +08:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default App;
|