import React, { useState } from 'react'; import { Drawer, DrawerProps } from 'antd'; interface ExtendedDrawerProps extends DrawerProps { visible: boolean; onClose: any; } const DrawerComponent: React.FC = ({ visible, onClose, title, placement, children }) => { return ( {children} ); }; const useDrawer = () => { const [visible, setVisible] = useState(false); const [content, setContent] = useState(null); const [drawerProps, setDrawerProps] = useState({ title: '', children: null, placement: 'right' }); const showDrawer = (component: React.ReactNode, props: DrawerProps) => { setContent(component); setDrawerProps(props); setVisible(true); }; const DrawerWrapper: React.FC = () => { return ( setVisible(false)} {...drawerProps} > {content} ); }; return { showDrawer, // hideDrawer, DrawerWrapper }; }; export default useDrawer;