diff --git a/README.md b/README.md index 87835758..0d3a9039 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ ReactDOM.render( | ---------------------- | ------------------------------ | --------- | ------------------------------------------------------------------------------- | ------- | | prefixCls | String | rc-dialog | The dialog dom node's prefixCls | | | className | String | | additional className for dialog | | +| classNames | { mask?: string; wrapper?: string; header?: string; body?: string; footer?: string} | | pass className to target area | | | style | Object | {} | Root style for dialog element.Such as width, height | | | zIndex | Number | | | | | bodyStyle | Object | {} | body style for dialog body element.Such as height | | diff --git a/src/Dialog/Content/Panel.tsx b/src/Dialog/Content/Panel.tsx index aeba8b82..7fedcd28 100644 --- a/src/Dialog/Content/Panel.tsx +++ b/src/Dialog/Content/Panel.tsx @@ -42,6 +42,7 @@ const Panel = React.forwardRef((props, ref) => { forceRender, width, height, + classNames: modalClassNames, } = props; // ================================= Refs ================================= @@ -78,13 +79,13 @@ const Panel = React.forwardRef((props, ref) => { // ================================ Render ================================ let footerNode: React.ReactNode; if (footer) { - footerNode =
{footer}
; + footerNode =
{footer}
; } let headerNode: React.ReactNode; if (title) { headerNode = ( -
+
{title}
@@ -105,7 +106,7 @@ const Panel = React.forwardRef((props, ref) => {
{closer} {headerNode} -
+
{children}
{footerNode} diff --git a/src/Dialog/Mask.tsx b/src/Dialog/Mask.tsx index 77169af4..e7ccb847 100644 --- a/src/Dialog/Mask.tsx +++ b/src/Dialog/Mask.tsx @@ -8,10 +8,11 @@ export type MaskProps = { motionName?: string; style?: React.CSSProperties; maskProps?: React.HTMLAttributes; + className?: string; }; export default function Mask(props: MaskProps) { - const { prefixCls, style, visible, maskProps, motionName } = props; + const { prefixCls, style, visible, maskProps, motionName, className } = props; return ( )} diff --git a/src/Dialog/index.tsx b/src/Dialog/index.tsx index 3dc6a661..9440de50 100644 --- a/src/Dialog/index.tsx +++ b/src/Dialog/index.tsx @@ -41,6 +41,7 @@ export default function Dialog(props: IDialogPropTypes) { maskStyle, maskProps, rootClassName, + classNames: modalClassNames, } = props; const lastOutSideActiveElementRef = useRef(); @@ -169,11 +170,12 @@ export default function Dialog(props: IDialogPropTypes) { ...maskStyle, }} maskProps={maskProps} + className={modalClassNames?.mask} />
`; + +exports[`dialog should support classNames 1`] = ` +
+
+
+