You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.0 KiB
48 lines
1.0 KiB
2 years ago
|
import React, { useState } from 'react';
|
||
|
import { Button, Drawer } from 'antd';
|
||
|
|
||
|
const App: React.FC = () => {
|
||
|
const [open, setOpen] = useState(false);
|
||
|
const [childrenDrawer, setChildrenDrawer] = useState(false);
|
||
|
|
||
|
const showDrawer = () => {
|
||
|
setOpen(true);
|
||
|
};
|
||
|
|
||
|
const onClose = () => {
|
||
|
setOpen(false);
|
||
|
};
|
||
|
|
||
|
const showChildrenDrawer = () => {
|
||
|
setChildrenDrawer(true);
|
||
|
};
|
||
|
|
||
|
const onChildrenDrawerClose = () => {
|
||
|
setChildrenDrawer(false);
|
||
|
};
|
||
|
|
||
|
return (
|
||
|
<>
|
||
|
<Button type="primary" onClick={showDrawer}>
|
||
|
Open drawer
|
||
|
</Button>
|
||
|
<Drawer title="Multi-level drawer" width={520} closable={false} onClose={onClose} open={open}>
|
||
|
<Button type="primary" onClick={showChildrenDrawer}>
|
||
|
Two-level drawer
|
||
|
</Button>
|
||
|
<Drawer
|
||
|
title="Two-level Drawer"
|
||
|
width={320}
|
||
|
closable={false}
|
||
|
onClose={onChildrenDrawerClose}
|
||
|
open={childrenDrawer}
|
||
|
>
|
||
|
This is two-level drawer
|
||
|
</Drawer>
|
||
|
</Drawer>
|
||
|
</>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
export default App;
|