Merge pull request #719 from smartxworks/feat/modal

feat(Modal): add hideFooter property
This commit is contained in:
tanbowensg 2023-08-30 13:48:09 +08:00 committed by GitHub
commit 8e6be1157c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -20,6 +20,7 @@ const exampleProperties: Static<typeof ModalPropsSpec> = {
confirmLoading: false,
defaultOpen: true,
unmountOnExit: true,
hideFooter: false,
};
export const Modal = implementRuntimeComponent({
version: 'arco/v1',
@ -48,7 +49,7 @@ export const Modal = implementRuntimeComponent({
},
})(props => {
const { getElement, subscribeMethods, slotsElements, customStyle, callbackMap } = props;
const { title, defaultOpen, ...cProps } = getComponentProps(props);
const { title, defaultOpen, hideFooter, ...cProps } = getComponentProps(props);
const [visible, setVisible] = useState(defaultOpen);
const contentRef = useRef<HTMLDivElement | null>(null);
@ -90,7 +91,7 @@ export const Modal = implementRuntimeComponent({
}}
afterClose={afterClose}
afterOpen={afterOpen}
footer={slotsElements.footer ? slotsElements.footer({}) : undefined}
footer={hideFooter ? null : slotsElements?.footer?.({})}
className={css(customStyle?.content)}
mountOnEnter={true}
{...cProps}

View File

@ -46,4 +46,8 @@ export const ModalPropsSpec = {
title: 'Destroy On Hide',
category: Category.Behavior,
}),
hideFooter: Type.Boolean({
title: 'Hide Footer',
category: Category.Behavior,
}),
};