-
-
Notifications
You must be signed in to change notification settings - Fork 262
Expand file tree
/
Copy pathantd-switch-multi.tsx
More file actions
44 lines (39 loc) · 1.01 KB
/
antd-switch-multi.tsx
File metadata and controls
44 lines (39 loc) · 1.01 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
33
34
35
36
37
38
39
40
41
42
43
44
/* eslint-disable no-console, react/require-default-props, no-param-reassign */
import React from 'react';
import { CommonMenu, inlineMotion } from './antd';
import '../../assets/index.less';
const Demo = () => {
const [inline, setInline] = React.useState(false);
const [openKeys, setOpenKey] = React.useState(['1']);
let restProps = {};
if (inline) {
restProps = { motion: inlineMotion };
} else {
restProps = { openAnimation: 'zoom' };
}
return (
<div style={{ margin: 20, width: 200 }}>
<label>
<input
type="checkbox"
checked={inline}
onChange={() => setInline(!inline)}
/>{' '}
Inline
</label>
<CommonMenu
mode="inline"
inlineMaxDeep={2}
openKeys={openKeys}
onOpenChange={keys => {
console.error('Open Keys Changed:', keys);
setOpenKey(keys);
}}
inlineCollapsed={!inline}
{...restProps}
/>
</div>
);
};
export default Demo;
/* eslint-enable */