index.tsx
798 Bytes
import { Drawer, type DrawerProps } from 'antd';
export type UDrawerProps = DrawerProps;
/**
* Unified detail drawer; responsive width and lifecycle defaults remain overridable.
* 约定:footer 里的取消/关闭按钮一律 type="default"(UButton 默认 primary,
* 不显式写就是主色)—— antd v6 的 Drawer 已无内置 footer 按钮,约定只能落在调用点。
*/
export function UDrawer({ size = 760, destroyOnHidden = true, styles, ...props }: UDrawerProps) {
return (
<Drawer
size={size}
destroyOnHidden={destroyOnHidden}
styles={(info) => {
const custom = typeof styles === 'function' ? styles(info) : styles;
return { ...custom, wrapper: { maxWidth: '94vw', ...custom?.wrapper } };
}}
{...props}
/>
);
}