Skip to content

Commit

Permalink
feat: update app demo (#39347)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
heiyu4585 and li-jia-nan committed Dec 14, 2022
1 parent 17b5c36 commit 49e8c13
Show file tree
Hide file tree
Showing 12 changed files with 293 additions and 185 deletions.
80 changes: 42 additions & 38 deletions components/app/__tests__/__snapshots__/demo-extend.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,46 +1,50 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`renders ./components/app/demo/message.tsx extend context correctly 1`] = `
exports[`renders ./components/app/demo/basic.tsx extend context correctly 1`] = `
<div
class="ant-app"
>
<button
class="ant-btn ant-btn-primary"
type="button"
<div
class="ant-space ant-space-horizontal ant-space-align-center"
>
<span>
Open message
</span>
</button>
</div>
`;

exports[`renders ./components/app/demo/modal.tsx extend context correctly 1`] = `
<div
class="ant-app"
>
<button
class="ant-btn ant-btn-primary"
type="button"
>
<span>
Open modal
</span>
</button>
</div>
`;

exports[`renders ./components/app/demo/notification.tsx extend context correctly 1`] = `
<div
class="ant-app"
>
<button
class="ant-btn ant-btn-primary"
type="button"
>
<span>
Open notification
</span>
</button>
<div
class="ant-space-item"
style="margin-right:8px"
>
<button
class="ant-btn ant-btn-primary"
type="button"
>
<span>
Open message
</span>
</button>
</div>
<div
class="ant-space-item"
style="margin-right:8px"
>
<button
class="ant-btn ant-btn-primary"
type="button"
>
<span>
Open modal
</span>
</button>
</div>
<div
class="ant-space-item"
>
<button
class="ant-btn ant-btn-primary"
type="button"
>
<span>
Open notification
</span>
</button>
</div>
</div>
</div>
`;
80 changes: 42 additions & 38 deletions components/app/__tests__/__snapshots__/demo.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,46 +1,50 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`renders ./components/app/demo/message.tsx correctly 1`] = `
exports[`renders ./components/app/demo/basic.tsx correctly 1`] = `
<div
class="ant-app"
>
<button
class="ant-btn ant-btn-primary"
type="button"
<div
class="ant-space ant-space-horizontal ant-space-align-center"
>
<span>
Open message
</span>
</button>
</div>
`;

exports[`renders ./components/app/demo/modal.tsx correctly 1`] = `
<div
class="ant-app"
>
<button
class="ant-btn ant-btn-primary"
type="button"
>
<span>
Open modal
</span>
</button>
</div>
`;

exports[`renders ./components/app/demo/notification.tsx correctly 1`] = `
<div
class="ant-app"
>
<button
class="ant-btn ant-btn-primary"
type="button"
>
<span>
Open notification
</span>
</button>
<div
class="ant-space-item"
style="margin-right:8px"
>
<button
class="ant-btn ant-btn-primary"
type="button"
>
<span>
Open message
</span>
</button>
</div>
<div
class="ant-space-item"
style="margin-right:8px"
>
<button
class="ant-btn ant-btn-primary"
type="button"
>
<span>
Open modal
</span>
</button>
</div>
<div
class="ant-space-item"
>
<button
class="ant-btn ant-btn-primary"
type="button"
>
<span>
Open notification
</span>
</button>
</div>
</div>
</div>
`;
7 changes: 7 additions & 0 deletions components/app/demo/basic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## zh-CN

获取 `message``notification``modal` 静态方法。

## en-US

Static method for `message`,`notification`,`modal`.
47 changes: 47 additions & 0 deletions components/app/demo/basic.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
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>
);
7 changes: 0 additions & 7 deletions components/app/demo/message.md

This file was deleted.

24 changes: 0 additions & 24 deletions components/app/demo/message.tsx

This file was deleted.

7 changes: 0 additions & 7 deletions components/app/demo/modal.md

This file was deleted.

27 changes: 0 additions & 27 deletions components/app/demo/modal.tsx

This file was deleted.

7 changes: 0 additions & 7 deletions components/app/demo/notification.md

This file was deleted.

28 changes: 0 additions & 28 deletions components/app/demo/notification.tsx

This file was deleted.

0 comments on commit 49e8c13

Please sign in to comment.