From 0ef093478752339ca1d7ad0d71fa063365b78bf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=91=E9=9B=A8?= Date: Thu, 17 Mar 2022 17:48:56 +0800 Subject: [PATCH 1/3] feat: add rootClassName --- src/Dialog/Mask.tsx | 7 ++++--- src/Dialog/index.tsx | 2 ++ src/IDialogPropTypes.tsx | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Dialog/Mask.tsx b/src/Dialog/Mask.tsx index 67982218..88da14ea 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; -} + rootClassName?: string; +}; export default function Mask(props: MaskProps) { - const { prefixCls, style, visible, maskProps, motionName } = props; + const { prefixCls, style, visible, maskProps, motionName, rootClassName } = props; return ( (
)} diff --git a/src/Dialog/index.tsx b/src/Dialog/index.tsx index 25bb5c3b..022b7185 100644 --- a/src/Dialog/index.tsx +++ b/src/Dialog/index.tsx @@ -47,6 +47,7 @@ export default function Dialog(props: IDialogChildProps) { maskClosable = true, maskStyle, maskProps, + rootClassName, } = props; const lastOutSideActiveElementRef = useRef(); @@ -172,6 +173,7 @@ export default function Dialog(props: IDialogChildProps) { zIndex, ...maskStyle, }} + rootClassName={rootClassName} maskProps={maskProps} />
Date: Fri, 18 Mar 2022 11:14:58 +0800 Subject: [PATCH 2/3] feat: update rootClassName --- src/Dialog/Mask.tsx | 5 ++--- src/Dialog/index.tsx | 6 ++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Dialog/Mask.tsx b/src/Dialog/Mask.tsx index 88da14ea..bd8e4d37 100644 --- a/src/Dialog/Mask.tsx +++ b/src/Dialog/Mask.tsx @@ -8,11 +8,10 @@ export type MaskProps = { motionName?: string; style?: React.CSSProperties; maskProps?: React.HTMLAttributes; - rootClassName?: string; }; export default function Mask(props: MaskProps) { - const { prefixCls, style, visible, maskProps, motionName, rootClassName } = props; + const { prefixCls, style, visible, maskProps, motionName } = props; return ( (
)} diff --git a/src/Dialog/index.tsx b/src/Dialog/index.tsx index 022b7185..f33792c7 100644 --- a/src/Dialog/index.tsx +++ b/src/Dialog/index.tsx @@ -164,7 +164,10 @@ export default function Dialog(props: IDialogChildProps) { // ========================= Render ========================= return ( -
+
Date: Fri, 18 Mar 2022 14:18:01 +0800 Subject: [PATCH 3/3] feat: add test case --- tests/__snapshots__/index.spec.tsx.snap | 97 +++++++++++++++++++++++++ tests/index.spec.tsx | 38 ++++++++-- 2 files changed, 130 insertions(+), 5 deletions(-) create mode 100644 tests/__snapshots__/index.spec.tsx.snap diff --git a/tests/__snapshots__/index.spec.tsx.snap b/tests/__snapshots__/index.spec.tsx.snap new file mode 100644 index 00000000..113560a9 --- /dev/null +++ b/tests/__snapshots__/index.spec.tsx.snap @@ -0,0 +1,97 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`dialog add rootClassName should render correct 1`] = ` +
+
+