docs: update demo (#41946)

* docs: update demo

* demo: delete div
This commit is contained in:
lijianan 2023-04-23 11:23:08 +08:00 committed by GitHub
parent 3fcf9de2b6
commit 99f0db6ea6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 398 additions and 412 deletions

View File

@ -1778,7 +1778,6 @@ exports[`renders components/button/demo/icon.tsx extend context correctly 1`] =
exports[`renders components/button/demo/legacy-group.tsx extend context correctly 1`] = `
Array [
<div>
<div
class="ant-btn-group ant-btn-group-sm"
>
@ -1891,10 +1890,8 @@ Array [
</div>
</div>
</div>
</div>
</div>,
<br />,
<div>
<div
class="ant-btn-group"
>
@ -2007,10 +2004,8 @@ Array [
</div>
</div>
</div>
</div>
</div>,
<br />,
<div>
<div
class="ant-btn-group ant-btn-group-lg"
>
@ -2123,7 +2118,6 @@ Array [
</div>
</div>
</div>
</div>
</div>,
]
`;

View File

@ -1621,7 +1621,6 @@ exports[`renders components/button/demo/icon.tsx correctly 1`] = `
exports[`renders components/button/demo/legacy-group.tsx correctly 1`] = `
Array [
<div>
<div
class="ant-btn-group ant-btn-group-sm"
>
@ -1696,10 +1695,8 @@ Array [
</svg>
</span>
</button>
</div>
</div>,
<br />,
<div>
<div
class="ant-btn-group"
>
@ -1774,10 +1771,8 @@ Array [
</svg>
</span>
</button>
</div>
</div>,
<br />,
<div>
<div
class="ant-btn-group ant-btn-group-lg"
>
@ -1852,7 +1847,6 @@ Array [
</svg>
</span>
</button>
</div>
</div>,
]
`;

View File

@ -1,10 +1,9 @@
import React from 'react';
import { DownloadOutlined } from '@ant-design/icons';
import { Button, Tooltip } from 'antd';
import type { ButtonGroupProps } from 'antd/es/button';
import React from 'react';
const getGroup = (props?: ButtonGroupProps) => (
<div>
const CustomGroup: React.FC<ButtonGroupProps> = (props) => (
<Button.Group {...props}>
<Button type="primary">Button 1</Button>
<Button type="primary">Button 2</Button>
@ -15,16 +14,15 @@ const getGroup = (props?: ButtonGroupProps) => (
<Button type="primary" icon={<DownloadOutlined />} />
</Tooltip>
</Button.Group>
</div>
);
const App: React.FC = () => (
<>
{getGroup({ size: 'small' })}
<CustomGroup size="small" />
<br />
{getGroup()}
<CustomGroup />
<br />
{getGroup({ size: 'large' })}
<CustomGroup size="large" />
</>
);