mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-16 09:39:10 +08:00
1e0c3b8c58
* feat: new component Flex * feat: new component Flex * fix: fix * test: add test case * fix: fix * update size-limit * test: update snap * fix: fix * test: update snap * chore: add use client * fix: lint * test: update snap * fix * docs: add docs * fix: fix demo * clear * demo: update demo * update demos * fix: fix * fix: fix * fix: fix * fix: fix * test: update snap * fix: fix * fix: fix * demo: update demo * feat: CP * fix: use token * fix: fix * fix: fix test case * test: update snap * Update components/flex/style/index.ts Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: lijianan <574980606@qq.com> * Update components/flex/demo/align.tsx Co-authored-by: MadCcc <1075746765@qq.com> Signed-off-by: lijianan <574980606@qq.com> * demo: update demo * fix: fix * docs * update cover * fix: fix * test: update case * fix: rerun CI * fix: fix * fix: fix * fix: fix * fix: fix * demo: update demo * fix: fix lint * fix: fix * fix: fix * fix: fix * fix: fix * fix: fix test case * fix: fix * docs: update docs * fix: fix * chore: fix * chore: fix * docs: update docs * docs: update * fix: fix demo * type: update type * add debug demo --------- Signed-off-by: lijianan <574980606@qq.com> Co-authored-by: 栗嘉男 <mac@macdeMacBook-Pro.local> Co-authored-by: MadCcc <1075746765@qq.com>
44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
import React from 'react';
|
|
import { Button, Flex, Segmented } from 'antd';
|
|
import type { FlexProps } from 'antd';
|
|
import type { SegmentedProps } from 'antd/es/segmented';
|
|
|
|
const boxStyle: React.CSSProperties = {
|
|
width: '100%',
|
|
height: 120,
|
|
borderRadius: 6,
|
|
border: '1px solid #40a9ff',
|
|
};
|
|
|
|
const justifyOptions = [
|
|
'flex-start',
|
|
'center',
|
|
'flex-end',
|
|
'space-between',
|
|
'space-around',
|
|
'space-evenly',
|
|
];
|
|
|
|
const alignOptions = ['flex-start', 'center', 'flex-end'];
|
|
|
|
const App: React.FC = () => {
|
|
const [justify, setJustify] = React.useState<FlexProps['justify']>(justifyOptions[0]);
|
|
const [alignItems, setAlignItems] = React.useState<FlexProps['align']>(alignOptions[0]);
|
|
return (
|
|
<Flex gap="middle" align="start" vertical>
|
|
<p>Select justify :</p>
|
|
<Segmented options={justifyOptions} onChange={setJustify as SegmentedProps['onChange']} />
|
|
<p>Select align :</p>
|
|
<Segmented options={alignOptions} onChange={setAlignItems as SegmentedProps['onChange']} />
|
|
<Flex style={boxStyle} justify={justify} align={alignItems}>
|
|
<Button type="primary">Primary</Button>
|
|
<Button type="primary">Primary</Button>
|
|
<Button type="primary">Primary</Button>
|
|
<Button type="primary">Primary</Button>
|
|
</Flex>
|
|
</Flex>
|
|
);
|
|
};
|
|
|
|
export default App;
|