ant-design/components/app/demo/basic.tsx
黑雨 49e8c13c24
feat: update app demo (#39347)
* feat: update demo

* feat: update app

* feat: update app

* feat: update app

* feat: update app

* Update index.tsx

* feat: update doc

* feat: update doc

* feat: reset doc

* feat: update doc

* feat: merge feature

* feat: update doc

* feat: update cover img

* feat: update doc

* feat: update doc

* feat: update doc

* feat: update snapshots

* feat: update doc

Co-authored-by: lijianan <574980606@qq.com>
2022-12-14 21:49:41 +08:00

48 lines
965 B
TypeScript

import React from 'react';
import { App, Button, Space } from 'antd';
// Sub page
const MyPage = () => {
const { message, modal, notification } = App.useApp();
const showMessage = () => {
message.success('Success!');
};
const showModal = () => {
modal.warning({
title: 'This is a warning message',
content: 'some messages...some messages...',
});
};
const showNotification = () => {
notification.info({
message: `Notification topLeft`,
description: 'Hello, Ant Design!!',
placement: 'topLeft',
});
};
return (
<Space>
<Button type="primary" onClick={showMessage}>
Open message
</Button>
<Button type="primary" onClick={showModal}>
Open modal
</Button>
<Button type="primary" onClick={showNotification}>
Open notification
</Button>
</Space>
);
};
// Entry component
export default () => (
<App>
<MyPage />
</App>
);