mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-11 23:00:20 +08:00
38 lines
755 B
TypeScript
38 lines
755 B
TypeScript
|
import React, { useState } from 'react';
|
||
|
import { Button, Drawer } from 'antd';
|
||
|
|
||
|
const App: React.FC = () => {
|
||
|
const [open, setOpen] = useState(false);
|
||
|
|
||
|
const showDrawer = () => {
|
||
|
setOpen(true);
|
||
|
};
|
||
|
|
||
|
const onClose = () => {
|
||
|
setOpen(false);
|
||
|
};
|
||
|
|
||
|
return (
|
||
|
<div className="site-drawer-render-in-current-wrapper">
|
||
|
Render in this
|
||
|
<div style={{ marginTop: 16 }}>
|
||
|
<Button type="primary" onClick={showDrawer}>
|
||
|
Open
|
||
|
</Button>
|
||
|
</div>
|
||
|
<Drawer
|
||
|
title="Basic Drawer"
|
||
|
placement="right"
|
||
|
closable={false}
|
||
|
onClose={onClose}
|
||
|
open={open}
|
||
|
getContainer={false}
|
||
|
>
|
||
|
<p>Some contents...</p>
|
||
|
</Drawer>
|
||
|
</div>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
export default App;
|