-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathAlign.tsx
More file actions
32 lines (28 loc) · 1.14 KB
/
Align.tsx
File metadata and controls
32 lines (28 loc) · 1.14 KB
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
32
import React from 'react';
import { Flex, Segmented, Button } from '@tiny-design/react';
export default function AlignDemo() {
const justifyOptions = ['flex-start', 'center', 'flex-end', 'space-between', 'space-around', 'space-evenly'];
const alignOptions = ['flex-start', 'center', 'flex-end'];
const [justify, setJustify] = React.useState('flex-start');
const [align, setAlign] = React.useState('flex-start');
const boxStyle = {
width: '100%',
height: 120,
borderRadius: 6,
border: '1px solid var(--ty-color-primary)',
};
return (
<Flex gap="md" align="flex-start" vertical>
<span>Select justify:</span>
<Segmented options={justifyOptions} value={justify} onChange={(val) => setJustify(val)} />
<span>Select align:</span>
<Segmented options={alignOptions} value={align} onChange={(val) => setAlign(val)} />
<Flex style={boxStyle} justify={justify} align={align}>
<Button btnType="primary">Primary</Button>
<Button btnType="primary">Primary</Button>
<Button btnType="primary">Primary</Button>
<Button btnType="primary">Primary</Button>
</Flex>
</Flex>
);
}