import React, { useContext } from 'react'; import { Drawer as OldDrawer, DrawerProps, ConfigProvider } from 'antd'; import './index.less'; import classNames from 'classnames'; import { Icon } from '../Icon'; import { Button } from '../Button'; import { AOP } from '../utils/AOP'; import { translate } from '../utils/index'; interface DrawerExtraProps { onCancel?: ( e: React.MouseEvent, ) => void; onOk?: (e: React.MouseEvent) => void; } const Drawer = ({ title, closable = true, width = '400px', footer, onOk, onCancel, closeIcon, extra, className, ...props }: DrawerProps & DrawerExtraProps) => { const { getPrefixCls, locale } = useContext(ConfigProvider.ConfigContext); const prefixCls = getPrefixCls('btri-drawer'); const newOnCancel = new AOP< React.MouseEvent, void >(onCancel) .after((e) => { props.onClose?.(e); }) .getFunction(); const getIcon = () => { if (!closable) { return null; } else { return (
{closeIcon ?? }
); } }; const getTitle = () => { return (
{title}
{extra} {getIcon()}
); }; // const getHeaderStyle = () => { // return { // padding: '16px', // borderBottom: '1px solid transparent', // ...headerStyle, // }; // }; // const getBodyStyle = () => { // return { // padding: '8px 16px', // ...bodyStyle, // }; // }; const getFooter = () => { if (footer === true) { return (
); } else { return footer; } }; return ( ); }; export { Drawer };