mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-07 17:44:35 +08:00

* feat[Divider]: Unified use of orientation attribute * feat: Restore the size type missed in the merge * feat: Delete unnecessary demo adjustments * docs: change text * feat: deprecated warning * Update components/divider/index.zh-CN.md Signed-off-by: thinkasany <480968828@qq.com> * Update components/divider/index.en-US.md Signed-off-by: thinkasany <480968828@qq.com> * feat: use useOrientation and change test,doc * feat: change demos orientation attribut * docs: change token and demo (orientationMargin->titlePlacementMargin) * feat: change demos titlePlacement="left/right" -> "start/end" * docs: titlePlacement align * feat: Resolve merge conflicts * fix: lint error * fix: demo lint error * feat: use mergedStyles.content * test: update snapshot * rerun ci * test: update snapshot * fix: delete titlePlacementMargin and udpate snapshots * feat: change demos orientationMargin-> styles.content.margin * Update components/divider/demo/vertical.md Co-authored-by: thinkasany <480968828@qq.com> Signed-off-by: EmilyyyLiu <100924403+EmilyyyLiu@users.noreply.github.com> * feat: Call warning using list * docs: `vertical` to make the divider vertical. * docs: Modify punctuation usage * docs: Add deprecated description * docs: Clarify the possible values for titlePlacement in the example * feat: replase { margin: '0' } ->{ margin: 0 } --------- Signed-off-by: thinkasany <480968828@qq.com> Signed-off-by: EmilyyyLiu <100924403+EmilyyyLiu@users.noreply.github.com> Co-authored-by: 刘欢 <lh01217311@antgroup.com> Co-authored-by: thinkasany <480968828@qq.com>
116 lines
4.1 KiB
TypeScript
116 lines
4.1 KiB
TypeScript
import React from 'react';
|
|
import { MinusSquareOutlined, SearchOutlined } from '@ant-design/icons';
|
|
import { Button, ConfigProvider, Divider, Flex, Radio, Tooltip, Input } from 'antd';
|
|
import type { ConfigProviderProps } from 'antd';
|
|
import { FiColumns } from 'react-icons/fi';
|
|
|
|
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 titlePlacement="start" 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>
|
|
<Divider plain> https://github.com/ant-design/ant-design/issues/51811 </Divider>
|
|
<div>
|
|
<Button>without icon</Button>
|
|
<Button icon={<SearchOutlined />}>with icon</Button>
|
|
</div>
|
|
<Divider plain> https://github.com/ant-design/ant-design/issues/52124 </Divider>
|
|
<div>
|
|
<Button
|
|
style={{
|
|
height: 60,
|
|
}}
|
|
>
|
|
without icon
|
|
</Button>
|
|
<Button
|
|
icon={<SearchOutlined />}
|
|
style={{
|
|
height: 60,
|
|
}}
|
|
>
|
|
with icon
|
|
</Button>
|
|
</div>
|
|
<Divider plain> https://github.com/ant-design/ant-design/issues/51380 </Divider>
|
|
<div>
|
|
<Button size="large" icon={<FiColumns className="my-class-name" />} />
|
|
<Button size="large" icon={<FiColumns />}>
|
|
custom icon
|
|
</Button>
|
|
<Button icon={<SearchOutlined />} />
|
|
<Button icon={<SearchOutlined />}>with icon</Button>
|
|
<Button size="large">without icon</Button>
|
|
<Input.Search style={{ width: 100 }} />
|
|
</div>
|
|
<Divider plain> https://github.com/ant-design/ant-design/issues/51380 </Divider>
|
|
<Flex
|
|
gap="small"
|
|
style={{
|
|
transform: 'scale(3)',
|
|
transformOrigin: 'left top',
|
|
}}
|
|
>
|
|
<Button icon={<MinusSquareOutlined />} />
|
|
<Button icon={<Icon12Size />} />
|
|
<Button icon={<Icon16Size />} />
|
|
<Button icon={<IconIrregularSize />} />
|
|
</Flex>
|
|
</Flex>
|
|
</ConfigProvider>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default App;
|