File size: 1,060 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
import React from 'react';
import { Button, Flex, Radio, Slider } from 'antd';
import type { ConfigProviderProps } from 'antd';
type SizeType = ConfigProviderProps['componentSize'];
const App: React.FC = () => {
const [gapSize, setGapSize] = React.useState<SizeType | 'customize'>('small');
const [customGapSize, setCustomGapSize] = React.useState<number>(0);
return (
<Flex gap="middle" vertical>
<Radio.Group value={gapSize} onChange={(e) => setGapSize(e.target.value)}>
{['small', 'middle', 'large', 'customize'].map((size) => (
<Radio key={size} value={size}>
{size}
</Radio>
))}
</Radio.Group>
{gapSize === 'customize' && <Slider value={customGapSize} onChange={setCustomGapSize} />}
<Flex gap={gapSize !== 'customize' ? gapSize : customGapSize}>
<Button type="primary">Primary</Button>
<Button>Default</Button>
<Button type="dashed">Dashed</Button>
<Button type="link">Link</Button>
</Flex>
</Flex>
);
};
export default App;
|