UNPKG

@wix/design-system

Version:

@wix/design-system

46 lines 2.82 kB
import React, { useEffect } from 'react'; import { classes } from './CustomModalLayout.classes'; import BaseModalLayout from '../BaseModalLayout'; import deprecationLog from '../utils/deprecationLog'; const CustomModalLayout = ({ theme, // TODO: add default value for skin once theme is removed actionsSize = 'small', removeContentPadding = false, showHeaderDivider = 'auto', showFooterDivider = 'auto', overflowY = 'auto', style = {}, ...propsWithNoDefaults }) => { const { children, content, width, maxWidth, height, maxHeight, className, footnoteSkin, ...restProps } = { theme, actionsSize, ...propsWithNoDefaults, }; const skin = restProps.skin || theme; const hasContent = Boolean(content); 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, content: content, skin: skin, className: 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' }, hasContent ? undefined : children), React.createElement(BaseModalLayout.Footer, { showFooterDivider: showFooterDivider === true }), React.createElement(BaseModalLayout.Footnote, { skin: footnoteSkin }), hasContent && children)); }; CustomModalLayout.Title = BaseModalLayout.Header.Title; CustomModalLayout.displayName = 'CustomModalLayout'; export default CustomModalLayout; //# sourceMappingURL=CustomModalLayout.js.map