@wix/design-system
Version:
@wix/design-system
44 lines • 2.72 kB
JavaScript
import React, { useEffect } from 'react';
import { st, classes } from './CustomModalLayout.st.css.js';
import BaseModalLayout from '../BaseModalLayout';
import deprecationLog from '../utils/deprecationLog';
const CustomModalLayout = ({ theme = 'standard', // TODO: add default value for skin once theme is removed
actionsSize = 'small', removeContentPadding = false, showHeaderDivider = 'auto', showFooterDivider = 'auto', overflowY = 'auto', style = {}, ...propsWithNoDefaults }) => {
const { children, width, maxWidth, height, maxHeight, className, footnoteSkin, ...restProps } = {
theme,
actionsSize,
...propsWithNoDefaults,
};
const skin = restProps.skin || theme;
useEffect(() => {
if (theme) {
deprecationLog('<CustomModalLayout/> - prop "theme" is deprecated and will be removed in next major release, please use "skin" property instead.');
}
if (overflowY === 'none') {
deprecationLog('<CustomModalLayout/> - prop "overflowY" value "none" is deprecated and will be removed in next major release, please use "visible" value instead.');
}
}, [theme, overflowY]);
return (React.createElement(BaseModalLayout, { ...restProps, skin: skin, className: st(classes.root, {
removeContentPadding,
showHeaderDivider: showHeaderDivider === true,
showFooterDivider: showFooterDivider === true,
}, className), style: {
...style,
width: width !== undefined ? width : style.width,
maxWidth: maxWidth !== undefined ? maxWidth : style.maxWidth,
height: height !== undefined ? height : style.height,
maxHeight: maxHeight !== undefined ? maxHeight : style.maxHeight,
}, "data-contentpadding": !removeContentPadding },
React.createElement(BaseModalLayout.Header, { showHeaderDivider: showHeaderDivider === true, titleSize: "medium", titleTag: "h2" }),
React.createElement(BaseModalLayout.Content
// TODO: remove type cast with major, once the 'none' value is removed
, {
// TODO: remove type cast with major, once the 'none' value is removed
overflowY: overflowY, hideTopScrollDivider: showHeaderDivider !== 'auto', hideBottomScrollDivider: showFooterDivider !== 'auto' }, children),
React.createElement(BaseModalLayout.Footer, { showFooterDivider: showFooterDivider === true }),
React.createElement(BaseModalLayout.Footnote, { skin: footnoteSkin })));
};
CustomModalLayout.Title = BaseModalLayout.Header.Title;
CustomModalLayout.displayName = 'CustomModalLayout';
export default CustomModalLayout;
//# sourceMappingURL=CustomModalLayout.js.map