refactor: update scroll modal

This commit is contained in:
jialin
2025-09-16 11:26:17 +08:00
parent 29b74f85c5
commit 55b0a20a4a
17 changed files with 340 additions and 163 deletions
+30 -2
View File
@@ -1,8 +1,9 @@
import OverlayScroller from '@/components/overlay-scroller';
import useBodyScroll from '@/hooks/use-body-scroll';
import { Modal, type ModalProps } from 'antd';
import React from 'react';
const ScrollerModal = (props: ModalProps) => {
const ScrollerModal = (props: ModalProps & { maxContentHeight?: number }) => {
const { saveScrollHeight, restoreScrollHeight } = useBodyScroll();
React.useEffect(() => {
@@ -13,7 +14,34 @@ const ScrollerModal = (props: ModalProps) => {
}
}, [props.open]);
return <Modal {...props} />;
return (
<Modal
{...props}
styles={{
content: {
padding: 0
},
header: {
padding: 'var(--ant-modal-content-padding)',
paddingBottom: '0'
},
body: {
padding: '0'
},
footer: {
padding: '12px 24px 24px',
margin: '0'
}
}}
>
<OverlayScroller
style={{ paddingInline: 24, paddingBlockEnd: props.footer ? 0 : 32 }}
maxHeight={props.maxContentHeight || 500}
>
{props.children}
</OverlayScroller>
</Modal>
);
};
export default ScrollerModal;