mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-22 22:48:29 +08:00
0aaab501d5
* style(Skeleton): remove default children of Skeleton.Node * style(Skeleton): remove default children of Skeleton.Node * Update components/skeleton/style/index.ts Co-authored-by: lijianan <574980606@qq.com> Signed-off-by: afc163 <afc163@gmail.com> --------- Signed-off-by: afc163 <afc163@gmail.com> Co-authored-by: lijianan <574980606@qq.com>
90 lines
3.3 KiB
TypeScript
90 lines
3.3 KiB
TypeScript
import React, { useState } from 'react';
|
|
import { DotChartOutlined } from '@ant-design/icons';
|
|
import type { RadioChangeEvent } from 'antd';
|
|
import { Flex, Divider, Form, Radio, Skeleton, Space, Switch } from 'antd';
|
|
|
|
type SizeType = 'default' | 'small' | 'large';
|
|
type ButtonShapeType = 'circle' | 'square' | 'round' | 'default';
|
|
type AvatarShapeType = 'circle' | 'square';
|
|
|
|
const App: React.FC = () => {
|
|
const [active, setActive] = useState(false);
|
|
const [block, setBlock] = useState(false);
|
|
const [size, setSize] = useState<SizeType>('default');
|
|
const [buttonShape, setButtonShape] = useState<ButtonShapeType>('default');
|
|
const [avatarShape, setAvatarShape] = useState<AvatarShapeType>('circle');
|
|
|
|
const handleActiveChange = (checked: boolean) => {
|
|
setActive(checked);
|
|
};
|
|
|
|
const handleBlockChange = (checked: boolean) => {
|
|
setBlock(checked);
|
|
};
|
|
|
|
const handleSizeChange = (e: RadioChangeEvent) => {
|
|
setSize(e.target.value);
|
|
};
|
|
|
|
const handleShapeButton = (e: RadioChangeEvent) => {
|
|
setButtonShape(e.target.value);
|
|
};
|
|
|
|
const handleAvatarShape = (e: RadioChangeEvent) => {
|
|
setAvatarShape(e.target.value);
|
|
};
|
|
|
|
return (
|
|
<Flex gap="middle" vertical>
|
|
<Space>
|
|
<Skeleton.Button active={active} size={size} shape={buttonShape} block={block} />
|
|
<Skeleton.Avatar active={active} size={size} shape={avatarShape} />
|
|
<Skeleton.Input active={active} size={size} />
|
|
</Space>
|
|
<Skeleton.Button active={active} size={size} shape={buttonShape} block={block} />
|
|
<Skeleton.Input active={active} size={size} block={block} />
|
|
<Space>
|
|
<Skeleton.Image active={active} />
|
|
<Skeleton.Node active={active} style={{ width: 160 }} />
|
|
<Skeleton.Node active={active}>
|
|
<DotChartOutlined style={{ fontSize: 40, color: '#bfbfbf' }} />
|
|
</Skeleton.Node>
|
|
</Space>
|
|
<Divider />
|
|
<Form layout="inline" style={{ margin: '16px 0' }}>
|
|
<Space size={16} wrap>
|
|
<Form.Item label="Active">
|
|
<Switch checked={active} onChange={handleActiveChange} />
|
|
</Form.Item>
|
|
<Form.Item label="Button and Input Block">
|
|
<Switch checked={block} onChange={handleBlockChange} />
|
|
</Form.Item>
|
|
<Form.Item label="Size">
|
|
<Radio.Group value={size} onChange={handleSizeChange}>
|
|
<Radio.Button value="default">Default</Radio.Button>
|
|
<Radio.Button value="large">Large</Radio.Button>
|
|
<Radio.Button value="small">Small</Radio.Button>
|
|
</Radio.Group>
|
|
</Form.Item>
|
|
<Form.Item label="Button Shape">
|
|
<Radio.Group value={buttonShape} onChange={handleShapeButton}>
|
|
<Radio.Button value="default">Default</Radio.Button>
|
|
<Radio.Button value="square">Square</Radio.Button>
|
|
<Radio.Button value="round">Round</Radio.Button>
|
|
<Radio.Button value="circle">Circle</Radio.Button>
|
|
</Radio.Group>
|
|
</Form.Item>
|
|
<Form.Item label="Avatar Shape">
|
|
<Radio.Group value={avatarShape} onChange={handleAvatarShape}>
|
|
<Radio.Button value="square">Square</Radio.Button>
|
|
<Radio.Button value="circle">Circle</Radio.Button>
|
|
</Radio.Group>
|
|
</Form.Item>
|
|
</Space>
|
|
</Form>
|
|
</Flex>
|
|
);
|
|
};
|
|
|
|
export default App;
|