-
-
Notifications
You must be signed in to change notification settings - Fork 229
/
Copy pathMask.tsx
48 lines (40 loc) · 875 Bytes
/
Mask.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import classNames from 'classnames';
import type { CSSMotionProps } from '@rc-component/motion';
import CSSMotion from '@rc-component/motion';
import * as React from 'react';
export interface MaskProps {
prefixCls: string;
open?: boolean;
zIndex?: number;
mask?: boolean;
// Motion
motion?: CSSMotionProps;
mobile?: boolean;
}
export default function Mask(props: MaskProps) {
const {
prefixCls,
open,
zIndex,
mask,
motion,
mobile,
} = props;
if (!mask) {
return null;
}
return (
<CSSMotion {...motion} motionAppear visible={open} removeOnLeave>
{({ className }) => (
<div
style={{ zIndex }}
className={classNames(
`${prefixCls}-mask`,
mobile && `${prefixCls}-mobile-mask`,
className,
)}
/>
)}
</CSSMotion>
);
}