{renderHeader(prefixCls)}
{slots.default?.()}
{renderFooter(prefixCls)}
);
};
const renderFooter = (prefixCls: string) => {
const footer = getPropsSlot(slots, props, 'footer');
if (!footer) {
return null;
}
const footerClassName = `${prefixCls}-footer`;
return (
);
};
const getOffsetStyle = () => {
// https://github.com/ant-design/ant-design/issues/24287
const { visible, mask, placement, size, width, height } = props;
if (!visible && !mask) {
return {};
}
const offsetStyle: CSSProperties = {};
if (placement === 'left' || placement === 'right') {
const defaultWidth = size === 'large' ? 736 : 378;
offsetStyle.width = typeof width === 'undefined' ? defaultWidth : width;
} else {
const defaultHeight = size === 'large' ? 736 : 378;
offsetStyle.height = typeof height === 'undefined' ? defaultHeight : height;
}
return offsetStyle;
};
return () => {
const {
prefixCls: customizePrefixCls,
width,
height,
visible,
placement,
mask,
className,
...rest
} = props;
const offsetStyle = mask ? getOffsetStyle() : {};
const haveMask = mask ? '' : 'no-mask';
const getPrefixCls = configProvider.getPrefixCls;
const prefixCls = getPrefixCls('drawer', customizePrefixCls);
const vcDrawerProps: any = {
...attrs,
...omit(rest, [
'size',
'closeIcon',
'closable',
'destroyOnClose',
'drawerStyle',
'headerStyle',
'bodyStyle',
'title',
'push',
]),
...offsetStyle,
onClose: close,
afterVisibleChange,
handler: false,
prefixCls,
open: visible,
showMask: mask,
placement,
wrapperClassName: classnames({
[className as string]: className,
[haveMask]: !!haveMask,
}),
style: getRcDrawerStyle(),
ref: vcDrawer,
};
return