Skip to content

Commit

Permalink
chore: fix lint (#229)
Browse files Browse the repository at this point in the history
  • Loading branch information
kerm1it authored Jan 12, 2021
1 parent 536f2ad commit 4a831fb
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/Dialog/Content/MemoChildren.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';

export interface MemoChildrenProps {
export type MemoChildrenProps = {
shouldUpdate: boolean;
children: React.ReactNode;
}
Expand Down
8 changes: 4 additions & 4 deletions src/Dialog/Content/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ import * as React from 'react';
import { useRef } from 'react';
import classNames from 'classnames';
import CSSMotion from 'rc-motion';
import { IDialogChildProps } from '..';
import type { IDialogChildProps } from '..';
import { offset } from '../../util';
import MemoChildren from './MemoChildren';

const sentinelStyle = { width: 0, height: 0, overflow: 'hidden', outline: 'none' };

export interface ContentProps extends IDialogChildProps {
export type ContentProps = {
motionName: string;
ariaId: string;
onVisibleChanged: (visible: boolean) => void;
onMouseDown: React.MouseEventHandler;
onMouseUp: React.MouseEventHandler;
}
} & IDialogChildProps

export interface ContentRef {
export type ContentRef = {
focus: () => void;
changeActive: (next: boolean) => void;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Dialog/Mask.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import classNames from 'classnames';
import CSSMotion from 'rc-motion';

export interface MaskProps {
export type MaskProps = {
prefixCls: string;
visible: boolean;
motionName?: string;
Expand Down
13 changes: 7 additions & 6 deletions src/Dialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@ import { useRef, useEffect } from 'react';
import classNames from 'classnames';
import KeyCode from 'rc-util/lib/KeyCode';
import contains from 'rc-util/lib/Dom/contains';
import ScollLocker from 'rc-util/lib/Dom/scrollLocker';
import { IDialogPropTypes } from '../IDialogPropTypes';
import type ScollLocker from 'rc-util/lib/Dom/scrollLocker';
import type { IDialogPropTypes } from '../IDialogPropTypes';
import Mask from './Mask';
import { getMotionName, getUUID } from '../util';
import Content, { ContentRef } from './Content';
import type { ContentRef } from './Content';
import Content from './Content';

export interface IDialogChildProps extends IDialogPropTypes {
export type IDialogChildProps = {
// zombieJ: This should be handle on top instead of each Dialog.
// TODO: refactor to remove this.
getOpenCount: () => number;
scrollLocker?: ScollLocker;
}
} & IDialogPropTypes

export default function Dialog(props: IDialogChildProps) {
const {
Expand Down Expand Up @@ -154,7 +155,7 @@ export default function Dialog(props: IDialogChildProps) {
return scrollLocker?.unLock;
}
return () => {};
}, [animatedVisible]);
}, [animatedVisible, scrollLocker]);

// ========================= Render =========================
return (
Expand Down
5 changes: 3 additions & 2 deletions src/DialogWrap.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as React from 'react';
import Portal from 'rc-util/lib/PortalWrapper';
import Dialog, { IDialogChildProps } from './Dialog';
import { IDialogPropTypes } from './IDialogPropTypes';
import type { IDialogChildProps } from './Dialog';
import Dialog from './Dialog';
import type { IDialogPropTypes } from './IDialogPropTypes';

// fix issue #10656
/*
Expand Down
12 changes: 6 additions & 6 deletions src/IDialogPropTypes.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ReactNode, CSSProperties, SyntheticEvent } from 'react';
import { GetContainer } from 'rc-util/lib/PortalWrapper';
import type { ReactNode, CSSProperties, SyntheticEvent } from 'react';
import type { GetContainer } from 'rc-util/lib/PortalWrapper';

export interface IDialogPropTypes {
export type IDialogPropTypes = {
className?: string;
keyboard?: boolean;
style?: CSSProperties;
Expand All @@ -23,9 +23,9 @@ export interface IDialogPropTypes {
maskTransitionName?: string;
animation?: any;
maskAnimation?: any;
wrapStyle?: {};
bodyStyle?: {};
maskStyle?: {};
wrapStyle?: Record<string, any>;
bodyStyle?: Record<string, any>;
maskStyle?: Record<string, any>;
prefixCls?: string;
wrapClassName?: string;
width?: number;
Expand Down
4 changes: 2 additions & 2 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ function getScroll(w: Window, top?: boolean): number {
return ret;
}

interface CompatibleDocument extends Document {
type CompatibleDocument = {
parentWindow?: Window;
}
} & Document

export function offset(el: Element) {
const rect = el.getBoundingClientRect();
Expand Down

1 comment on commit 4a831fb

@vercel
Copy link

@vercel vercel bot commented on 4a831fb Jan 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.