mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-05 01:19:45 +08:00
e825e781de
* fix: respect notification placement in App * style: sort imports * fix: prioritize global config Fixes regression on global config test from previous change * test: check if notification placement works * lint: use consistent-type-import * style: remove extra new lines in import block * docs: update config demo * chore: fix lint --------- Co-authored-by: 二货机器人 <smith3816@gmail.com>
37 lines
769 B
TypeScript
37 lines
769 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>
|
|
<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>
|
|
);
|