mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-21 04:48:02 +08:00
093c6c2d1f
Some checks are pending
Publish Any Commit / build (push) Waiting to run
🔀 Sync mirror to Gitee / mirror (push) Waiting to run
✅ test / lint (push) Waiting to run
✅ test / test-react-legacy (16, 1/2) (push) Waiting to run
✅ test / test-react-legacy (16, 2/2) (push) Waiting to run
✅ test / test-react-legacy (17, 1/2) (push) Waiting to run
✅ test / test-react-legacy (17, 2/2) (push) Waiting to run
✅ test / test-node (push) Waiting to run
✅ test / test-react-latest (dom, 1/2) (push) Waiting to run
✅ test / test-react-latest (dom, 2/2) (push) Waiting to run
✅ test / test-react-latest-dist (dist, 1/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist, 2/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist-min, 1/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist-min, 2/2) (push) Blocked by required conditions
✅ test / test-coverage (push) Blocked by required conditions
✅ test / build (push) Waiting to run
✅ test / test lib/es module (es, 1/2) (push) Waiting to run
✅ test / test lib/es module (es, 2/2) (push) Waiting to run
✅ test / test lib/es module (lib, 1/2) (push) Waiting to run
✅ test / test lib/es module (lib, 2/2) (push) Waiting to run
👁️ Visual Regression Persist Start / test image (push) Waiting to run
81 lines
2.9 KiB
TypeScript
81 lines
2.9 KiB
TypeScript
import React from 'react';
|
|
import { MinusSquareOutlined, SearchOutlined } from '@ant-design/icons';
|
|
import { Button, ConfigProvider, Divider, Flex, Radio, Tooltip } from 'antd';
|
|
import type { ConfigProviderProps } from 'antd';
|
|
|
|
type SizeType = ConfigProviderProps['componentSize'];
|
|
|
|
/**12px 图标 */
|
|
const Icon12Size = () => <div style={{ background: 'red', width: 12, height: 12 }} />;
|
|
/**16px 图标 */
|
|
const Icon16Size = () => <div style={{ background: 'green', width: 16, height: 16 }} />;
|
|
/**不规则宽高 */
|
|
const IconIrregularSize = () => <div style={{ background: 'blue', width: 14, height: 16 }} />;
|
|
|
|
const App: React.FC = () => {
|
|
const [size, setSize] = React.useState<SizeType>('large');
|
|
return (
|
|
<>
|
|
<Radio.Group value={size} onChange={(e) => setSize(e.target.value)}>
|
|
<Radio.Button value="large">Large</Radio.Button>
|
|
<Radio.Button value="default">Default</Radio.Button>
|
|
<Radio.Button value="small">Small</Radio.Button>
|
|
</Radio.Group>
|
|
<Divider orientation="left" plain>
|
|
Preview
|
|
</Divider>
|
|
<ConfigProvider componentSize={size}>
|
|
<Flex gap="small" vertical>
|
|
<Flex gap="small" wrap>
|
|
<Tooltip title="search">
|
|
<Button type="primary" shape="circle" icon={<SearchOutlined />} />
|
|
</Tooltip>
|
|
<Button type="primary" shape="circle">
|
|
A
|
|
</Button>
|
|
<Button type="primary" icon={<SearchOutlined />}>
|
|
Search
|
|
</Button>
|
|
<Tooltip title="search">
|
|
<Button shape="circle" icon={<SearchOutlined />} />
|
|
</Tooltip>
|
|
<Button icon={<SearchOutlined />}>Search</Button>
|
|
</Flex>
|
|
<Flex gap="small" wrap>
|
|
<Tooltip title="search">
|
|
<Button shape="circle" icon={<SearchOutlined />} />
|
|
</Tooltip>
|
|
<Button icon={<SearchOutlined />}>Search</Button>
|
|
<Tooltip title="search">
|
|
<Button type="dashed" shape="circle" icon={<SearchOutlined />} />
|
|
</Tooltip>
|
|
<Button type="dashed" icon={<SearchOutlined />}>
|
|
Search
|
|
</Button>
|
|
<Button icon={<SearchOutlined />} href="https://www.google.com" target="_blank" />
|
|
<Button>
|
|
<SearchOutlined />
|
|
Search
|
|
</Button>
|
|
</Flex>
|
|
<Flex
|
|
gap="small"
|
|
style={{
|
|
// https://github.com/ant-design/ant-design/issues/51380 // 视觉回归测试
|
|
transform: 'scale(3)',
|
|
transformOrigin: 'left top',
|
|
}}
|
|
>
|
|
<Button icon={<MinusSquareOutlined />} />
|
|
<Button icon={<Icon12Size />} />
|
|
<Button icon={<Icon16Size />} />
|
|
<Button icon={<IconIrregularSize />} />
|
|
</Flex>
|
|
</Flex>
|
|
</ConfigProvider>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default App;
|