mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-16 01:29:11 +08:00
dc9e4572ff
* demo: App demo update * test: Update test snapshots
37 lines
774 B
TypeScript
37 lines
774 B
TypeScript
import React from 'react';
|
|
import { App, Button, Space } from 'antd';
|
|
|
|
// Sub page
|
|
const MyPage = () => {
|
|
const { message, notification } = App.useApp();
|
|
|
|
const showMessage = () => {
|
|
message.success('Success!');
|
|
};
|
|
|
|
const showNotification = () => {
|
|
notification.info({
|
|
message: `Notification`,
|
|
description: 'Hello, Ant Design!!',
|
|
});
|
|
};
|
|
|
|
return (
|
|
<Space wrap>
|
|
<Button type="primary" onClick={showMessage}>
|
|
Message for only one
|
|
</Button>
|
|
<Button type="primary" onClick={showNotification}>
|
|
Notification for bottomLeft
|
|
</Button>
|
|
</Space>
|
|
);
|
|
};
|
|
|
|
// Entry component
|
|
export default () => (
|
|
<App message={{ maxCount: 1 }} notification={{ placement: 'bottomLeft' }}>
|
|
<MyPage />
|
|
</App>
|
|
);
|