Skip to content

Commit fcb258d

Browse files
zktzkt
authored andcommitted
style: optimize code formatting and naming convention
1 parent 8cbf1c5 commit fcb258d

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

src/Dialog/index.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,6 @@ const Dialog: React.FC<IDialogPropTypes> = (props) => {
113113
const mouseDownOnMaskRef = useRef(false);
114114
const mouseUpOnMaskRef = useRef(false);
115115

116-
117-
118116
// >>> Wrapper
119117
// Close only when element not on dialog
120118
let onWrapperClick: (e: React.SyntheticEvent) => void = null;
@@ -131,11 +129,11 @@ const Dialog: React.FC<IDialogPropTypes> = (props) => {
131129
};
132130
}
133131

134-
function onModulesMouseDownCapture(e: React.MouseEvent) {
132+
function onWrapperMouseDownCapture(e: React.MouseEvent) {
135133
mouseDownOnMaskRef.current = e.target === wrapperRef.current;
136134
}
137135

138-
function onModulesMouseUpCapture(e: React.MouseEvent) {
136+
function onWrapperMouseUpCapture(e: React.MouseEvent) {
139137
mouseUpOnMaskRef.current = e.target === wrapperRef.current;
140138
}
141139

@@ -161,8 +159,6 @@ const Dialog: React.FC<IDialogPropTypes> = (props) => {
161159
}
162160
}, [visible]);
163161

164-
165-
166162
const mergedStyle: React.CSSProperties = {
167163
zIndex,
168164
...wrapStyle,
@@ -189,8 +185,8 @@ const Dialog: React.FC<IDialogPropTypes> = (props) => {
189185
className={clsx(`${prefixCls}-wrap`, wrapClassName, modalClassNames?.wrapper)}
190186
ref={wrapperRef}
191187
onClick={onWrapperClick}
192-
onMouseDownCapture={onModulesMouseDownCapture}
193-
onMouseUpCapture={onModulesMouseUpCapture}
188+
onMouseDownCapture={onWrapperMouseDownCapture}
189+
onMouseUpCapture={onWrapperMouseUpCapture}
194190
style={mergedStyle}
195191
{...wrapProps}
196192
>

tests/mask-closable.spec.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import React from 'react';
32
import { render, fireEvent, act } from '@testing-library/react';
43
import Dialog from '../src';

0 commit comments

Comments
 (0)